Replies
Welcome, guest
Join CrazyEngineers to reply, ask questions, and participate in conversations.
CrazyEngineers powered by Jatra Community Platform
-
@radha-BTDzli • Feb 20, 2015
For example I write
case 1: int a=9; break;
printf("hellooo");
case 2 : int y =98;
printf("kill");
break;
So here when parsing is done so either the compiler should throw any error because of printf statement or it must print the statement which is written between the two cases but it skips it ,so why does it happen? -
@shiva6-6QW9Ti • Feb 22, 2015
Because the compiler never reaches that printf statement. When it encountered the break statement, it just skips all the remaining lines of code in that switch block and goes to the next immediate line after the switch block. That is how the break statement works.
-
@neeraj-iAaNcG • Feb 24, 2015
You have simply broken the construct here:
case 1: int a=9; break;
break statement breaks the switch construct thereon and comes out of that construct