by denniskubes · 13y ago · 0 comments
The point I was trying to make is that &x would return a number not an assignable memory location. The reason it isn't an lvalue is because it doesn't return a memory address the way a variable assignment or dereference would.
I was probably a bit confusing in what I was trying to say.
(x + 1) = 12
because (x+1) doesn't live in a writable location. int *ptr = &x;
ptr = 20;
The rvalue/lvalue distinction is completely unrelated to pointers, holding memory addresses versus numbers representing memory addresses, etc. The & operator simply doesn't give you an lvalue, like most operators in C, and this has nothing to do with addresses, pointers, or anything of the like