📜  枚举 case 语句 - C 编程语言代码示例

📅  最后修改于: 2022-03-11 15:04:37.394000             🧑  作者: Mango

代码示例1
typedef enum {
    NEG_INF,
    ZERO,
    POS_INF,
    NOT_SPECIAL

} extrema;

int main(){

    extrema check = POS_INF;

    switch(check){
        case NEG_INF: printf("neg inf"); return 1;
        case ZERO: printf("zero"); return 2;
        case POS_INF: printf("pos inf"); return 3;
        default: printf("not special"); break;
    }

    return 0;

}