为什么 C 枚举常量需要一个名字?因为:
#include <stdio.h>
enum {NO, YES};
int main(void)
{
printf("%d\n", YES);
}
工作原理与此相同:
#include <stdio.h>
enum boolean {NO, YES};
int main(void)
{
printf("%d\n", YES);
}
最佳答案
这样就可以创建枚举类型的变量了:
enum boolean read_file = NO;
关于c - 为什么 C 枚举常量需要一个名字?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1849895/