Switch Statement in C

Last Updated Nov 4, 2015, 07:00:14 PM

Switch statements in c deal with complex conditional statements. The switch case statement helps us to solve complex branching problems within the body.

Switch statement is mainly used when the program the has to chose a particular statement among many other statements.


Control passes to the statement whose case constant-expression matches the value of the switch ( expression ). The switch statement can include any number of case instances, but no two case constants within the same switch statement can have the same value. Execution of the statement body begins at the selected statement and proceeds until the end of the body or until a break statement transfers control out of the body.

Example of Switch Case in C

Try It Now
  • A single switch statement in c can have any no of case statements in it
  • If the break statement encountered then the switch will terminates.
  • Switch statement can have a default statement incase to execute as a default result.

Other Decision Making Topics you might want to learn

If Statement in C

If else Statement in C

Nested If Statement in C