可以在不指定标记的情况下创建枚举类型的变量,因此没有枚举类型名称。因为没有类型名称,所以以后在代码中无法定义此类型的其他变量。
#include <stdio.h> int main(void) { enum {red, orange, yellow, green, blue, indigo, violet} shirt_color; shirt_color = red; printf("%d\n",shirt_color); return 0; }