switch problem - interesting !!

O

onkar

#include<stdio.h>
int main(void){
int q,i,j,count;
i=j=0;
q=2;
count=6;
switch(3){
case 0:
while(--count>0){
case 1:
printf("case-1\n");
++j;
case 2:
printf("case-2\n");
++i;
case 3:
printf("case-3\n");
case 4:
printf("case-4\n");
case 5:
printf("case-5\n");
}
}
printf("%d %d\n",i,j);
return 0;
}


case-3
case-4
case-5
case-1
case-2
case-3
case-4
case-5
case-1
case-2
case-3
case-4
case-5
case-1
case-2
case-3
case-4
case-5
case-1
case-2
case-3
case-4
case-5
case-1
case-2
case-3
case-4
case-5
5 5


gives me this !!
I thought compiler will give some sort of parse error. Please explain.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top