c switch statement -
void display() { printf("every thing ok"); } void main() { int ch; while(1) { printf("enter choice"); scanf("%d",&ch); switch(ch) { case 1: clrscr();printf("when choice 1 every thing fine"); display(); break; case 2: clrscr();printf("when chice 2 confusing"); display(); break; case 3: exit(0); default: printf("enter choice 1 or 2 or exit enter 3"); } } }
when trace c program , enter choice 2 calls display function case 1 block. not understand this. please reply explanation. confused.
the compiler re-arranging source statements collapsing basic blocks. debugger matches calls display()
in both cases same source line number. usual when optimization enabled.
Comments
Post a Comment