Disadvantages of switch Statement in C++
- Switch case can only evaluate int or char type.
- No support for logical expressions.
- Have to keep in mind to add a break in every case.
Switch Statement in C++
The C++ Switch case statement evaluates a given expression and based on the evaluated value(matching a certain condition), it executes the statements associated with it. It is an alternative to the long if-else-if ladder which provides an easy way to dispatch execution to different parts of code based on the value of the expression.