【C语言资料更新】C语言中的枚举类型(enum)
enum 枚举名{
标识符[=整型常数],
标识符[=整型常数],
...
标识符[=整型常数]
} 枚举变量;
typedef enum
{
标识符[=整型常数],
标识符[=整型常数],
...
标识符[=整型常数]
} 枚举数据类型;
typedef enum
{
SUNDAY= 0,
MONDAY= 1,
TUESDAY = 2,
WEDNESDAY = 3,
THURSDAY = 4,
FRIDAY = 5,
SATURDAY = 6
} EWeekday_t;//定义枚举类型
EWeekday_t Wekday; //定义枚举变量
typedef enum{ SUNDAY= 0, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY , SATURDAY} EWeekday_t;//定义枚举类型EWeekday_t Wekday; //定义枚举变量
赞 (0)