Hello friends!!!!!
C Switch Statement
C LANGUAGE
10/10/20241 min read
The switch statement in C is an alternative to if-else-if ladder statement, which allows to execute multiple operations for the different possible values of a single variable which is called as switch variable. We can define various statements in the multiple cases for the different values of a single variable.
The syntax of switch statement in C language is represented as,
switch(expression) {
case value1:
//code to be executed
break;
case value2:
//code to be executed
break;
case 3:
//code to be executed
break;
default:
//code to be executed, if all the above cases are completely wrong
}