break问题,为何第二个注释是终止第一个switch
# include <stdio.h>
int main()
{
int x = 1, y = 0, a = 0, b = 0;
switch(x) //第一个switch
{
case 1:
switch(y) //第二个switch
{
case 0:
a++;
break;//终止的是第二个switch
case 1:
b++;
break;//终止的是第一个switch
}
b = 100;
break;
case 2:
a++;
b++;
break;
}
printf("a = %d, b = %d\n", a, b);
return 0;
}