well, this is an interesting question. when you remove the const x prefix, you will get the result as you wish.
int main()
{
int x = 10;
int * p = (int *)&x;
*p = 12;
cout<<x<<endl;
cout<<*p<<endl;
return 0;
}
I think this is a constant label preventing the x value from changing.
source
share