码迷,mamicode.com
首页 > 其他好文 > 详细

c语音学习系列——day11——c的枚举

时间:2018-01-05 21:58:06      阅读:114      评论:0      收藏:0      [点我收藏+]

标签:color   输出   return   表示   str   数字   枚举   ret   ring   

 

枚举表示数字 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的枚举

标签:color   输出   return   表示   str   数字   枚举   ret   ring   

原文地址:https://www.cnblogs.com/yeyusheng/p/8206667.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!