Switch break statement in c/c++

main()
{
int i=2;
switch(i);
{
case 1:
printf(“one”);
break;
case 2:
printf(“two”);
case 3:
printf(“three”);
break;
}
}
Tutorial answer:two,three
Debugger solution:Because in the case 2.it does not contain break statement.

Post a Comment

0 Comments