Memory addresses are often displayed in hex formate like 0x7ffff3a9ae94
. Why we can't directly assign these values to pointers?
int *ptr=7ffff3a9ae94;
A "similar" behavior was shown when i tried this.(This might be a separate question itself)
int i=0;
*ptr=&i;
&i=ptr;
Both cases show syntax errors on g++ 4.7.2
which, i assume means its a language restriction.
Why this restriction is implemented in C++?
Or is this some kind of OS limitation?
Note: This question have similar title but it doesn't provide me answer to my question.