Home » C Programming » Constants » Question
  1. What will be the output of the following C function?
    #include <stdio.h>
    enum car {AstonMartin, Audi, Chevrolet, Ferrari};
    enum color {Yellow = 5, Green, RedBlue, Blue};
    int main()
    {
    enum car c = Yellow;
    int i;
    i = c;
    printf("%d\n", i);
    return 0;
    }
    1. Compilation Error
    2. Yellow
    3. AstonMartin
    4. 5
    5. Runtime Error
Correct Option: D

c is an integer constant, hence it is compatible.



Your comments will be displayed only after manual approval.