可以用 #define 定义一个标识符来表示一个常量。其特点是:定义的标识符不占内存,只是一个临时的符号,预编译后这个符号就不存在了。
-
# include <stdio.h> # define NUM 5//将NUM确定为5 int main(void) { }
const限定符
const type name=value;//格式
const int Months=12//将Months确定为12
可以用 #define 定义一个标识符来表示一个常量。其特点是:定义的标识符不占内存,只是一个临时的符号,预编译后这个符号就不存在了。
# include <stdio.h>
# define NUM 5//将NUM确定为5
int main(void)
{
}
const限定符
const type name=value;//格式
const int Months=12//将Months确定为12