MCQ Single Best Answer Not Set

QWhat is the output of this C code?
 
#include <stdio.h>
    int main()
    {
        enum {ORANGE = 5, MANGO, BANANA = 4, PEACH};
        printf("PEACH = %d\n", PEACH);
    }

ID: #1358 Constant in C Language 10,544 views
Question Info
#1358Q ID
Not SetDifficulty
Constant in C LanguageTopic

Choose the Best Option

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

  • A PEACH = 3
  • B PEACH = 4
  • C PEACH = 5
  • D PEACH = 6
Correct Answer: Option C

Explanation

Answer:c
In enum, the value of constant is defined to the recent assignment from left. Output:
$ cc pgm1.c
$ a.out
PEACH = 5

Share This Question

Challenge a friend or share with your study group.