Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

enum case statement in c

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;

}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #enum #case #statement
ADD COMMENT
Topic
Name
7+6 =