enum 枚举类型
语法:
enum Nanme{
name1 = number1,
name2 = number2,
};
举例:
enum Day{
mon = 1;
tue = 2;
};
enum Day day=mon;
printf("day is %d",day);
输出:
注意事项:
1.若枚举类型中的首个元素未定义则默认为0
2.枚举类型的非首元素的默认值为上一个元素的值+1,即为枚举元素默认自增1
个人理解:
enum Day{
mon = 1, <====> #define mon 1
tue = 10, #define tue 10
};
标签:01enum,enum,tue,Day,枚举,mon,数据结构,day From: https://www.cnblogs.com/hhdc/p/18124450