When compiling gcc and then running it, the code
int * p;
int main () {* p = 1;}
causes a segmentation error.
Apparently, the memory location contained in p cannot be written to.
Why????
On the other hand,
int q [];
int main () {* q = 1;}
works great.
What's going on here?
Why does p only contain read-only memory?
source share