三坪房间的侵略者 bd:const的用法
来源:百度文库 编辑:高考问答 时间:2024/05/06 12:40:49
以下程序:
#include <stdio.h>
int main()
{
const int age=-435;
printf("please enter a number:");
scanf("%d",&age);
printf("the number you entered was %d.", age);
return 0;
}
不是说const的不能更改吗,为何在运行该程序之后,我输入一个新的数给age,之后显示的却是新的数????
另外我用的是turboc2, 不是太老的原因吧。。。
#include <stdio.h>
int main()
{
const int age=-435;
printf("please enter a number:");
scanf("%d",&age);
printf("the number you entered was %d.", age);
return 0;
}
不是说const的不能更改吗,为何在运行该程序之后,我输入一个新的数给age,之后显示的却是新的数????
另外我用的是turboc2, 不是太老的原因吧。。。