next up previous contents
Next: 運算子 ?: Up: 判斷 Previous: switch statement   Contents

nested switch statements

  1. 語法
    switch(ch1) {
       case 'A': 
          printf("This A is part of outer switch" );
          switch(ch2) {
             case 'A':
                printf("This A is part of inner switch" );
                break;
             case 'B': /* case code */
          }
          break;
       case 'B': /* case code */
    }
    



2015-01-16