C语言嵌套的switch语句

#include stdio.hint main () {/* local variable definition */int a = 100;int b = 200;switch(a) {

编程学习网为您整理以下代码实例,主要实现:C语言嵌套的switch语句,希望可以帮到各位朋友。

#include <stdio.h>

int main () {

   /* local variable deFinition */
   int a = 100;
   int b = 200;

   switch(a) {

      case 100: 
         printf("This is part of outer switch\n", a );

         switch(b) {
            case 200:
               printf("This is part of inner switch\n", a );
         }
   }

   printf("Exact value of a is : %d\n", a );
   printf("Exact value of b is : %d\n", b );

   return 0;
}

本文标题为:C语言嵌套的switch语句

上一篇: C语言switch语句
下一篇: C语言if...else语句

基础教程推荐