What if I don’t write default in switch case?

The code is valid. If there is no default: label and none of the case labels match the “switched” value, then none of the controlled compound statement will be executed. Execution will continue from the end of the switch statement.

ISO/IEC 9899:1999, section

[…] If no converted case constant expression matches and there is no default label, no part of the switch body is executed.

Leave a Comment