如下例是可以執行的:
#include <stdio.h>
int main(void){
enum color_type { red, green, white,pink,black=2,blue};
enum color_type mycolor;
mycolor = white;
printf("%d\n", mycolor); // 2
mycolor = black;
printf("%d\n", mycolor); //2
mycolor = pink;
printf("%d\n", mycolor); //3
mycolor = blue;
printf("%d\n", mycolor); //3
return 0;
}
|