switch ()语句的理解
#include "stdio.h"
int main(void)
{
int k;
char c;
char s[] = "ABCCDA";
for (k = 1; (c = s[k] != '\0'); k++)
{
switch (c)
{
case 'A' : putchar ('%'); continue;
case 'B' : ++k; break;
default : putchar ('*'); //为什么s[1]=B时会直接跳到default语句, 而接着运行case 'C'. 如果把default/case 'c'交换位置,则运行的结果又不一样.
case 'C' : putchar ('&'); continue;
}
putchar ('#');
}
getch ();
return 0;
}