In XCode I've tried to manipulate const int
value by using pointer. Here is the code:
const int con = 5;
int *p;
p = &con;
(*p) +=1;
printf("Add of constant:%p\n",&con);
printf("Add of pointer:%p\n",p);
printf("%d - %d",con,*p);
Result is like that on XCode:
Add of constant:0x7fff5fbff79c
Add of pointer:0x7fff5fbff79c
5 - 6
but on linux virtual machine values of con
and *p
is same 6
.
Why there is a difference between values on XCode?