switch | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2


is any limitation in switch in c++ i mean, can use switch for any data type (for example, string)? why i'm asking? because of this: error: switch quantity not an integer

26th Nov 2018, 10:51 AM
Abolhasan Ashori
Abolhasan Ashori - avatar
1 Answer
+ 8
You can use with integral types or enumerated types. Remember the expression passed in switch need to result in a constant.
26th Nov 2018, 11:10 AM
Anya - avatar