/* * meiju.c * * Created on: 2017年9月15日 * Author: Administrator * 137 */ enum COLOR { RED,YELLOW,BLUE,GREEN }; int favorate_color = RED; void main2(){ puts("---------------------"); //枚举内容默认值从0开始,逐步加1 printf("%d\n",RED); printf("%d\n",YELLOW); printf("%d\n",BLUE); puts("---------------------"); //枚举内容根据前面的那一个值加1 printf("%d\n",RED); printf("%d\n",YELLOW); printf("%d\n",BLUE); set_favorate_color(BLUE); printf("favorate_color = %d\n",favorate_color); }
转载于:https://www.cnblogs.com/liangjinjie/p/7573795.html