hello,
const int *ptr1 mean i can change value of ptr1 but not of *ptr1
right? then why following snippet doesnot give error?
int val=50;
const int *ptr1=&val;
*(int *)ptr1=98; //what is this casting?
printf("\n%d %d",++val,*ptr1 ); //99 98 is output
regards,
rahul
const int *ptr1 mean i can change value of ptr1 but not of *ptr1
right? then why following snippet doesnot give error?
int val=50;
const int *ptr1=&val;
*(int *)ptr1=98; //what is this casting?
printf("\n%d %d",++val,*ptr1 ); //99 98 is output
regards,
rahul
Comment