My code:
#include <stdio.h>
main()
{
const int x = 10;
int *p;
p=&x;
*p=20;
printf("Value at p: %d \n",*p);
printf("Value at x: %d", x);
}
The output I get is:
Value at p: 20
Value at x: 20
Thus, the value of a constant variable is changed. Is this one of the disadvantages of using pointers?