Home » C Programming » C Enumeration (Enum) » Question
  1. Which of the following is the correct output for the program given below?
    #include <studio.h>
    int main()
    {
    enum result {pass, fail, waiting};
    enum result result1, result2, result3;
    stud1 = pass;
    stud2 = waiting;
    stud3 = fail;
    printf("%d %d %d\n",result1, result2, result3);
    return 0;
    }
    1. 0 1 2
    2. 1 2 3
    3. 0 2 1
    4. 1 3 2
Correct Option: C

Enum elements always take values like 0, 1, 2, etc.
So pass = 0, fail = 1 and waiting= 2



Your comments will be displayed only after manual approval.