How does this not work?!
I am under the impression that one can declare a pointer, list, and assign to it values as if it were an array. I attempted to do so, and got the error: lvalue required as left operand of assignment.
int a=2, b=3;
list = &a;
(list + 1)= &b; /* why does this not work? */
That is true but:
Originally Posted by cjavier
a) list needs to point to an array or chunk of memory first
b) even if it were, you're adding the addresses of variables into that array
The closest thing I can make to your example would be:
Notice that I had to declare an array of 2 elements.
int a = 2, b = 3;
*list = &a;
*(list + 1) = &b;