The code is simple,I just want to test the priority between & and ++.
int main()
{
int a=10;
int *p;
int *q;
p=&++a;//error: lvalue required as unary ‘&’ operand
q=&a++;//error: lvalue required as unary ‘&’ operand
return 0;
}
when gcc compile it, two errors came out. In my opinion,a++
is a right value,but the ++a
is a lvalue,so it should not be an error when use & to get it address,