Question 12
Back to Exercise
Is case 90 ... 100: valid standard C?
- A Yes, since C99
- B Yes, since C23
- C No – case ranges are a GNU extension (proposed for the next standard); use an if-else ladder Correct
- D Only for char values
Correct Answer: Option C
Standard C, C23 included, allows only single constant case labels. GCC and Clang accept ranges as an extension, and Clang with -pedantic-errors rejects them as "a C2y extension". For ranges, if-else is the portable tool.
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!