Switch default statement in c/c++

main()
{
int i=2;
switch(i);
{
default:
printf(“zero”);
case 1:
printf(“one”);
break;
case 2:
printf(“two”);
break;
case 3:
printf(“three”);
break;
}

}

Tutorial answer: two

Debugger solution:The default case can be placed anywhere inside the loop.it is executed only when all other case doesn’t match

Related post