MCQ Single Best Answer Not Set

QWhat is the output of this C code?

#include <stdio.h>
    enum birds {SPARROW, PEACOCK, PARROT};
    enum animals {TIGER = 8, LION, RABBIT, ZEBRA};
    int main()
    {
        enum birds m = TIGER;
        int k;
        k = m;
        printf("%d\n", k);
        return 0;
    }

ID: #1363 Constant in C Language 14,620 views
Question Info
#1363Q ID
Not SetDifficulty
Constant in C LanguageTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • B Compile time error
  • C 1
  • D 8
Correct Answer: Option D

Explanation

Answer:d
m is an integer constant, hence compatible. Output:
$ cc pgm5.c
$ a.out
8

Share This Question

Challenge a friend or share with your study group.