R
rahul8143
hello,
Check following code that changes const i value.
include <stdio.h>
int main()
{
const int i=10;
int *p;
p=&i;
(*p)++;
printf("\n %d",i);
return 0;
}
we know that (*p)++ is same as *p=*p+1 then why i am not allowed to
directly assign new value to i
i.e. *p=15;
Isn't *p=*p+1 is reassinging new value to i?
Check following code that changes const i value.
include <stdio.h>
int main()
{
const int i=10;
int *p;
p=&i;
(*p)++;
printf("\n %d",i);
return 0;
}
we know that (*p)++ is same as *p=*p+1 then why i am not allowed to
directly assign new value to i
i.e. *p=15;
Isn't *p=*p+1 is reassinging new value to i?