question about const pointers and const ints
I was just browsing through a few C exercises, came across this:
The following code:
says it will give compiler error.
int const * p=5;
But doesnt int const *p mean, constant pointer to an int ??
So, *p dereferences the pointer and ++ increments the value.
Shouldnt the answer be 6 ??
If the statement were like this:
const int * p=5;
then ++(*p) would have given an error.
That is just my explanation. feel free to throw light on the same.