【发布时间】:2014-11-25 14:21:36
【问题描述】:
我正在回答来自this textbook 的教科书问题。
我正在学习 C 中的指针,并且遇到了左值和右值。据我了解:
l-values are values that are defined after they are executed (++x)
r-values are values that are not defined after they are executed (x++)
对吗?
我想回答的问题(通过我的尝试):
a) Which of the following C expressions are L-Values?
1. x + 2 Not a L value
2. &x Is a L value
3. *&x Is a L value
4. &x + 2 Not a L value
5. *(&x + 2) Is a L value
6. &*y Is a L value
b) Is it possible for a C expression to be a L-value but NOT a R-value? Explain
I've read that a L value can be a R value but not vice versa. I can't think of an example of something being an L value but not a R value.
c) Is &(&z) ever legal in C? Explain
Assuming this is not legal since a memory address doesn't have its own memory address?
我接近了吗?谢谢
【问题讨论】:
标签: c pointers memory-address dereference