title: c switch statement
body: <pre><code>void display()
  {
      printf("every thing is ok");
  }
  void main()
  {
      int ch;
      while(1)
      {
          printf("enter your choice");
          scanf("%d",&amp;ch);
          switch(ch)
  
          {
              case 1: clrscr();printf("when choice is one every thing is fine");
                      display();
                      break;
              case 2: clrscr();printf("when chice is two its confusing");
                      display();
                      break;
              case 3: exit(0);
              default: printf("enter choice as 1 or 2 or to exit enter 3");
          }
      }
  }
  </code></pre>
  
  <p>When I trace this C program and enter the choice as 2 it calls the display function from the case 1 block. I do not understand this. Please reply with an explanation. I am really confused.</p>