c - Pointer to char array -


int main( ){         char a[2];     char *p;     p=&a[0];     *(p+5)='g'; } 

in above program defined pointer pointing char array array 3 bytes only. let me tell more clearly,for instance let assume char array address 1000 takes upto 1003 bytes, using pointer storing ascii value of 'g' @ 1005 location. okay compiler ? memory static alloacted 1 ? or can used again ? value permanently stored in or no?

you changing random memory location in program. undefined behavior , have random effects on program such segmentation fault.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -