枚举表示数字 0,1,2 .....一直累加
如下代码:
#include <stdio.h>
#include <string.h>
enum Color
{
pink,red,yellow
};
int main() {
printf("%d\n", red);
enum Color c = yellow;
printf("%d\n", c);
system("pause");
return 0;
}
输出结果是
1
2
枚举表示数字 0,1,2 .....一直累加
如下代码:
#include <stdio.h>
#include <string.h>
enum Color
{
pink,red,yellow
};
int main() {
printf("%d\n", red);
enum Color c = yellow;
printf("%d\n", c);
system("pause");
return 0;
}
输出结果是
1
2
原文:https://www.cnblogs.com/yeyusheng/p/8206667.html