下面的代码中,*a
是右值还是左值?
#include <stdio.h>
void main()
{
int b=2;
int *a=NULL;
a=&b;
*a=3;
printf("%d",*a);
}
最佳答案
正如 http://en.wikipedia.org/wiki/Value_%28computer_science%29 中所公开的:
Lvalues have memory addresses that are programmatically accessible to the running program (e.g., via some address-of–operator like "&" in C/C++), meaning that they are variables or dereferenced references to a certain memory location. Rvalues can be lvalues (see below) or non-lvalues
所以,*a 是左值
关于c - *p 是左值还是右值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17684476/