10
Where does a const variable gets stored exactly and how does it behaviour change? Say for example:
const int i=10; // stores where ?
main()
{
const int j=20; //stores where?
return 0;
}
If the answer is Code segment then how does the following code work??
main()
{
const int j=20;
int *p;
p=&j;
(*p)++;
return 0 ;
}
This code works fine... How it is possible to change a read only memory? How does it really get stored? Please explain it to me in detail.