枚举表示数字 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
Posted 不甘平凡,叶育生
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了c语音学习系列——day11——c的枚举相关的知识,希望对你有一定的参考价值。
枚举表示数字 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
以上是关于c语音学习系列——day11——c的枚举的主要内容,如果未能解决你的问题,请参考以下文章