Why the Switch statement is used?
Asked By
0 points
N/A
Posted on - 06/04/2020
I have a question on Switch statement in C program. Why the Switch statement is used? Could you explain with an example so that I can prepare well for my exams?
I have a question on Switch statement in C program. Why the Switch statement is used? Could you explain with an example so that I can prepare well for my exams?
Switch statement is a multi way decision making system in C programming language.
General syntax of the switch statement is as follows
Â
Switch (expression)
{
Case 1:
Statement 1;
break;
Â
Case 2:
Statement 2;
break;
.
.
.
Default:
statement;
break;
Â
}
Â
The break statement at the end of each case block shows the end of that case and exit from the switch statement.