0
Can the expression evaluated by switch be a string?
It gave me an error when I tried it.
6 Respostas
0
You can switch only integers. So you can create special key for you String value and switch it by keys.
0
Using strings with switch statements is illegal in C++, the reason being strings aren't necessarily supported as a type, but more of an array of characters, and the language doesn't quite understand that. With certain other languages though (such as C#) strings CAN be implemented into switch statements.
0
Thanks.
0
you can switch integer and char.
0
it is illegal in c c++ java but legal in php
0
not at all