
#define _CRT_SECURE_NO_WARNINGS 1//什么是常量//C语言的常量分为以下几种//1.字面常量//2.const修饰的变量//3.#define定义的标识符常量//4.枚举常量////1.字面常量#include stdio.h//int mian()//{/3.14;10;‘a’;“abcdef”;2.const修饰的常量///const int num10;num就是常变量具有常属性不能被改变的属性/num 20;///err const修饰的常量不允许修改//int arr[10] { 0 };//const int n 10;//int arr2[n] { 0 };//n是变量所以不行要常量才行//return 0;//}//3.#define定义的标识符常量//#define MAX 10000//int main()//{// MAX 20000//err// int n MAX;// printf(“n%d\n”, n);// return 0;//}//4.枚举常量enum Sex{//这种枚举类型的变量的未来可能取值MALE,//(MALE3)赋初值不能在函数里赋值FEMALE,SECRET};int main(){enum Sex s MALE;//MALE3;//errprintf(“%d\n”, MALE);printf(“%d\n”, FEMALE);printf(“%d\n”, SECRET);return 0;}