+ 1
Why I can only use switch statements in C++ only for intergers?
4 Answers
+ 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.