switch语句问题
switch(x){
i = 1;
case 0:
break;
case 1:
break;
case 2:
break;
}
在这段程序中 i = 1;是不是不会执行啊?
#include<stdio.h> int main() { int i=0; int x; scanf("%d",&x); switch(x) { i = 1; case 0: printf("00000\n"); break; case 1: printf("111111\n"); break; case 2: printf("222222\n"); break; } printf("i=%d\n",i); return 0; } /*在VC++6.0中的输出结果为: ------------------------------- 2 222222 i=0 Press any key to continue ------------------------------- */