c - WHY the following program is not giving error? -
#include<stdio.h> void main () { int a=4; const int *p=&a; *p--; }
in above line means can not change value via p, in decrement statement should give error not giving error. can explain why??
*p--
decrements p
not contents of p
.
if (*p)--
compilation error
error: decrement of read-only location ‘*p’