LearnFrenzy
Sign in Take a free test

Structures, Unions, Enums · Structures, Unions & Enums MCQ · Question 11

C23 enum with a fixed underlying type Answer, explanation & discussion

  • MCQ
  • Hard
  • 0 comments
  • Answer explained
  • Moderated community
Question 11 Back to Exercise

What does enum status : unsigned char { OK, FAIL }; do in C23?

  • A It is a syntax error
  • B It fixes the enum's underlying type, so sizeof(enum status) is 1 Correct
  • C It limits the enum to 2 values
  • D It makes OK and FAIL characters
Correct Answer: Option B

C23 lets you choose the integer type behind an enum. The size becomes predictable (1 byte here), which matters for binary formats; values outside the type's range are errors.

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.

Popular