【发布时间】:2011-11-21 00:42:54
【问题描述】:
switch(ch){
case 'a':
//do something, condition does not match so go to default case
//don't break in here, and don't allow fall through to other cases.
case 'b':
//..
case 'c':
//..
case '_':
//...
default:
//
break;
}
在上面的 switch 语句中,我输入 case 'a',只有当其中的条件发生时才中断,否则我想跳转到默认情况。除了标签或 goto 之外,还有其他方法吗?
【问题讨论】:
标签: c switch-statement break