假设定义:
int i = 10;
int *p = &i;
为什么 *p 在这里是一个有效的左值:
*p+=10;
不应该 *p 评估存储在 &i 的 int 值,即。 10,并因此产生“不是左值”错误?
最佳答案
An lvalue is an expression that refers to a region of storage that can be manipulated.
*p
就是这样一个表示存储区域的表达式。这与 10+=10;
不同,因为 10
不像变量那样引用存储区域。
关于c - 取消引用的指针是有效的左值吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4773839/