<分区>
考虑以下两种情况。 case1: 编译器错误 --> error: increment of read-only variable ‘x’
#include<stdio.h>
main()
{
const int x=5;
printf("%d",++x);
}
案例 2:运行成功,输出为 6。为什么?
#include<stdio.h>
main()
{
const int x=5;
int *ptr=&x;
++(*ptr);
printf("%d",x);
}