Getting Started With C

switch statements

Syntax:

switch (expression) {
case value1:
// code block
break;
case value2:
// code block
break;
// more cases as needed
default:
// code block for default case
}

Explanation:

Sample code:

Program.c

output:

output.c

Resources :

Featured
Special title treatment

With supporting text below as a natural lead-in to additional content.

Q1. A switch statement is used to

Q2. If switch feature is used, then