R
Rajat
Hi all,
See the below code. Can u tell me what will be the output and why??
int main()
{
const int c = 16;
int *p = &c;
*p = 4;
printf("c=%d, *p=%d",c,*p);
return 0;
}
I tested this on gcc, the result was c=16 *p= 4. As far as I think it
should give error while changing the read only memory content i.e. c,
or if it allow changes then it should reflect for bot c and *p.
See the below code. Can u tell me what will be the output and why??
int main()
{
const int c = 16;
int *p = &c;
*p = 4;
printf("c=%d, *p=%d",c,*p);
return 0;
}
I tested this on gcc, the result was c=16 *p= 4. As far as I think it
should give error while changing the read only memory content i.e. c,
or if it allow changes then it should reflect for bot c and *p.