Hi,
I tried the following program :
Though PI has been made const int i am still able to modify its value through a pointer. Why is that?Code:#include<stdio.h> #include<string.h> int main() { const int PI=3; int *ptr; printf("Original Value of PI = %d\n",PI); ptr=&PI; *ptr=4; printf("Value of PI after modification = %d\n",PI); return 0; }
Thanks