source: src/Clight/test/switcher.c @ 770

Last change on this file since 770 was 770, checked in by campbell, 10 years ago

Clight and Cminor examples for switch statement.

File size: 238 bytes
Line 
1extern int get(void);
2
3int main(void) {
4  char i = 0;
5
6  switch(get()) {
7  case 1:
8    break;
9  case 3:
10    i++;
11    break;
12  case 5:
13    i+=2;
14    /* fall through */
15  case 7:
16    i+=3;
17    break;
18  default:
19    i+=16;
20  }
21  return i;
22}
Note: See TracBrowser for help on using the repository browser.