在 C 语言中,你可以使用 printf() 函数来打印枚举类型。
printf()
首先,你需要在枚举类型定义的时候为每一个枚举值赋予一个字符串的别名:
enum color { RED = "Red", BLUE = "Blue", GREEN = "Green" };