I guess everybody is getting confused as to what the constant is all about and here is what I have to say that will clear all the doubts.

const is a type of variable whose value cannot and should not be changed. Now there seems to be a different in the compilation when you have the file extension is .c and .cpp.

Here a sample program
Code: C
const int i = 10;
void main()
{
    char arr[i];
}
The above program will compile successfully in .cpp file extension but not in .c file extension suggesting that the const behaves as compile time constant as well as runtime constant.

Taking other example
Code: C
void main()
{
    int const i=123;
    int *ip;
   
    char const c='c';
    char *cp;
   
    char const *arr="coderzone";
    char **arrp;
   
    // Changing constant integer i.e. const int/int const
   
    printf(" %d %x \n",i,&i);
    ip=&i;
    *ip=456;
    printf(" %d %x %x %d \n\n",i,&i,ip,*ip);
   
    // Changing constant character i.e. const char/char const
   
    printf(" %c %x \n",c,&c);
    cp=&c;
    *cp='a';
    printf(" %c %x %x %c \n\n",c,&c,cp,*cp);
   
    // Changing constant string i.e. const char * /char const
   
    printf(" %s %x \n",arr,&arr);
    arrp=&arr;
    *arrp="go4expert";
    printf(" %s %x %x %s \n\n",arr,&arr,arrp,*arrp);
}
The above sample when compiled in .c file will give 3 warning but will compile and run succesfully giving you an edited value of the constant but will give error in .cpp file and so the gist is in C const is not a compile time constant but in cpp it is.

I hope this clears the mystery of const somewhat

Thanks
Shabbir