开发者

General practice to specify a break after a default clause? [duplicate]

This question already has answers here: 开发者_高级运维 Closed 12 years ago.

Possible Duplicate:

break in a case with return.. and for default

If I have a switch statement:

switch()
{
    case 1: ...
    case 2: ...
    ...
    default:
        break;
}

Is there any reason for the break in the default clause? I see this in quite a few places, but isn't it unnecessary? What is the general practice?

Can another case label come after the default clause?


Can another case label come after the default clause?

Yes, you are allowed to place the default clause anywhere within the switch block.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜