const修饰的变量不是真的常量,它只是告诉编译器该变量不能出现在赋值符号的左边
const 不能定义真正意义上常量
#include<stdio.h>
int main()
{
const int c = 0;
int *p = (int *)&c;
printf("Begin...\n");
*p = 5;
printf("c = %d\n",c);
printf("End...\n");
return 0;
}
注意: C++编译器虽然可能为const常量分配空间,但不会使用其存储空间的值