Home » C Programming » Constants » Question
  1. What will be the output of the following C code?
    #include <stdio.h>
    #define MAX 3
    enum car {AstonMartin = MAX + 1, Audi = AstonMartin + MAX};
    int main()
    {
    enum car c = Audi;
    printf("%d\n", c);
    return 0;
    }
    1. 3
    2. Compilation Error
    3. 7
    4. Runtime Error
    5. None of these
Correct Option: C

MAX value is 3 and hence Audi will have value 4 + 3.



Your comments will be displayed only after manual approval.