A

Admin • 833K Points
Coach

Q. What is the output of the following code?

Code:
enum color {RED, GREEN, BLUE};
int main() {
enum color c = GREEN;
printf("%d", c);
}
  • (A) 1
  • (B) 0
  • (C) 2
  • (D) Depends on compiler
  • Correct Answer - Option(A)
  • Views: 18
  • Filed under category C Programming
  • Hashtags:

Explanation by: Admin

Enums start at 0 by default, so GREEN is 1.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.