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

 

posted @ 2018-01-05 20:35  和美信息叶育生博文  阅读(134)  评论(0编辑  收藏  举报