boot2

Playing with the boostrap
git clone https://git.ryansepassi.com/git/boot2.git
Log | Files | Refs | README

065-switch.c (280B)


      1 int main(void) {
      2     int x; int s;
      3     x = 2;
      4     s = 0;
      5     switch (x) {
      6         case 1: s = s + 1;
      7         case 2: s = s + 2;
      8         case 3: s = s + 3;
      9         default: s = s + 4;
     10     }
     11     /* x = 2 hits case 2; falls through case 3 + default; s = 2+3+4 = 9 */
     12     return s;
     13 }