I also don't think step 4 willl work how can it will try to change the value of x answer is 5.
Martyf said:
(Tue, Sep 13, 2011 10:36:57 AM)
It is very difficult paper.
Prakash said:
(Sun, Oct 30, 2011 12:16:54 PM)
int main()
{
int x=5;
int *ptrx;
ptrx = &x;
*ptrx = 10;
printf("%d\n", x);
return 0;
}
To change the value of const variable x we have to use *(int *)&x = 10;
Bijay said:
(Thu, Dec 1, 2011 01:09:52 PM)
In gcc compiler it will work o/p:10.
Voski said:
(Mon, Jan 16, 2012 11:23:57 AM)
A small correction in the Explanation Step 2 is needed: ptrx is not a constant, but a pointer to an integer constant.