Top

Discussion

What is the output of this C code?

int main()
{
enum {ORANGE = 12, MANGO, BANANA = 11, APPLE};
printf("APPLE = %d\n", APPLE);
}

 

  • A.APPLE= 11
  • B.APPLE= 12
  • C.APPLE= 23
  • D.APPLE= 0

Answer: B

In enum, the value of constant is defined to the recent assignment from left.

No comment is present. Be the first to comment.
Loading…

Post your comment