在C中使用枚举类型的变量作为字符串的简单方法?
typedef enum { ONE, TWO, THREE } Numbers;char num_str[10];int process_numbers_str(Numbers num) {
switch(num) {
case ONE:
case TWO:
case THREE:
{
strcpy(num_str, num); //some way to get the symbolic constant name in here?
} break;
default:
return 0; //no match
return 1;}郎朗坤
吃鸡游戏
相关分类