1#include <stdio.h>
2
3int main(void)
4{
5 int a = 0;
6
7 switch(a)
8 {
9 case 1 :
10 statement("a = 1");
11 break;
12
13 case 2 :
14 printf("a = 2");
15 break;
16
17 default :
18 printf("a is neither 1 or 2");
19 break;
20 }
21}
1switch (expression) {
2 case constant1:
3 // statements
4 break;
5
6 case constant2:
7 // statements
8 break;
9
10 default:
11 // default statements
12}
1char letter switch(int letter)
2{
3char res;
4switch (letter)
5{
6case 0*41:
7res= 'a\0';
8break;
9case 0*42;
10res='b\0';
11break;
12case 0*43;
13res='c\0';
14break;
15default:
16res='z\0'
17break;
18}
19return res;
20}