switch | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 2

switch

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 Respuesta
+ 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
Anya - avatar