LearnFrenzy
Sign in Take a free test

Declarations and Initializations · Predict the Output · Question 7

Enum constants with explicit and implicit values Answer, explanation & discussion

  • Output
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
Question 7 Back to Exercise

What is the output of the following C program on a 64-bit system?

main.c
#include <stdio.h>

enum level { LOW = 1, MID, HIGH = 10, MAX };

int main(void) {
    printf("%d %d %d\n", MID, HIGH, MAX);
    return 0;
}
  • A 2 10 11 Correct
  • B 1 10 11
  • C 2 3 4
  • D 2 10 3
Correct Answer: Option A

A constant without a value is one more than the previous: MID = 2 and MAX = 11.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links