+ 1
Why I can only use switch statements in C++ only for intergers?
4 Réponses
+ 8
You can use them for every primitive datatype.
+ 5
sorry you can't proof that
(╯°□°)╯︵ ┻━┻
the switch accepts cases of the same type, look 👇.
switch (8) {} // where 8 is integer
you can only use integers as cases
switch ("8") {} // where 8 is string
you can only use strings as cases
+ 1
Switch is used for all primative data types.