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!