+ 1
Why dereference doesnt work with addresses directly?
when a pointer p=&var; why dont *p=*&var; ??? is it just the way they are defined??
3 Respostas
+ 1
yeah... agreed. but what my point is... when a pointer p represents an adress, and *p gives its value, why does *&var, where &var is the address of variable var, give an error
0
i think because the variable var has not always to be a pointer itself, and you can perform the * operator only on pointers. so *p = var should be correct if var is not a pointer i guess.
0
because var itself is perhaps not declared as a pointer but as normal variable.