Should we break the default case in switch statement?

后端 未结 7 1489
北荒
北荒 2020-12-15 16:51

Assuming this example code (source):

#include 

void playgame()
{
    printf( \"Play game called\" );
}
void loadgame()
{
    printf( \"Load g         


        
7条回答
  •  时光取名叫无心
    2020-12-15 17:52

    if default case is at last then break statement have no use. if it is before any other case then break is required. since usually we are putting default at the end so you can omit it..

提交回复
热议问题