+ 6
Why strings can't be used in switch case in C++. Please answer me.
3 Answers
+ 5
the tone of this question sounds like we are the language specification committee đ
đ
đ
, and we should add it in the upcoming draft
+ 1
A string in C/C++ is an array. The raw value isn't the string itself but rather a pointer to the data.
0
The switch case only works with integers or things that evaluate as integers (like enums or macros).