title: How to do switching between two diffrent swich statements using C?
body: <p>I have written a c code for switching between two different switch statements,<br>
  but I am looking for a more generic solution, meaning without using state variable and while loop, or jump from one switch statement to another switch statement.
  I want some suggestion or key input from you.</p>
  
  <p>Thank you and please excuse my poor English. </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int main() 
  {   
      unsigned char state,state1;
      enum
      {
          Add,Sub,Mul,Div,START,STOP
      }Arith_Op;
  
      enum
      {
          Add1,Sub1,Mul1,Div1,START1,STOP1
      }Arith_Op1;
  
      Arith_Op = Add;
          Arith_Op1 = Add1;
      state = START;
      while (state != STOP) 
      {
          switch(Arith_Op)
          {
              case Add :
                  printf("Add\n");
                  Arith_Op = Sub;
              break;
  
              case Sub :
                  printf("sub\n");
                  Arith_Op = Mul;
              break;
  
              case Mul :
                  printf("mul\n");
                  Arith_Op = Div;
              break;
  
              case Div :
                  printf("div\n");
                  Arith_Op = STOP;
              break;
  
              default :
                  printf("default\n");
                  state = STOP;
                  state1 = START1;
              break;  
          }
      }
      printf(" state out of while and Switch case ");
  
  
  
      while (state1 != STOP1) 
      {
          switch(Arith_Op1)
          {
              case Add1 :
                  printf("Add1\n");
                  Arith_Op1 = Sub1;
              break;
  
              case Sub1 :
                  printf("sub1\n");
                  Arith_Op1 = Mul1;
              break;
  
              case Mul1 :
                  printf("mul1\n");
                  Arith_Op1 = Div;
              break;
  
              case Div1 :
                  printf("div1\n");
                  Arith_Op1 = STOP1;
              break;
  
              default :
                  printf("default1\n");
                  state1 = STOP1;
              break;  
          }
      }
      printf(" state 1 out of while and Switch case ");
      return 0;
  }
  </code></pre>