그동안 몰랐던 이상야릇한 C언어 switch 구문형태이다~
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | int counter = 0; int n = 0; int somefun() { switch(n){ case 0: while(1){ n = 12; case 12: if(!(counter == 1000)) return 0; printf("Threshold reached\n"); counter = 0; } } n = 0; return 2; } int { somefun(); // case 0 somefun(); // case 12 return 0; } |
Pastie #2495563 linked directly from Pastie.