Question 12
Back to Exercise
In C23, which use is valid for constexpr int N = 8; that is not valid for const int N = 8;?
- A Reading N in printf
- B Using N as a case label or a global array size Correct
- C Taking its address
- D Passing it to a function
Correct Answer: Option B
A constexpr object is an integer constant expression, so it can appear wherever C requires one – case labels, static array sizes, bit-field widths. A plain const int cannot.
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!