Hi, My question is this:
The code
int a=0;
printf("%p", &a);
shows on the screen the memory address of variable a, so why can't I assign this value to another variable -
int a=0;
int x=0;
x=&a;
If &a gives a raw number as it does in the printf command, why can't x take the value of this number? The code works if I use *x=0, but I can't see why it needs that.
Thanks for any help.



LinkBack URL
About LinkBacks



they are both used for pointers -> is also equivelent to *(&) ( I think )
But it is not "wrong". To say
I am still confused. &a just returns a simple number (which happens to be a memory address) right, so why can't I assign that number to an ordinary integer variable?