小编Er *_*ngh的帖子

在C中使用逻辑运算符切换案例

我是C的新手,需要帮助.我的代码如下.

 #include<stdio.h>  
 #include<conio.h>  
 void main()
 {

  int suite=2;  

  switch(suite)
     {           
      case 1||2:
      printf("hi");

      case 3:
      printf("byee");

      default:
      printf("hello");
     }

  printf("I thought somebody");
  getche();
  }
Run Code Online (Sandbox Code Playgroud)

我在Turbo C工作,输出是helloI thought somebody.没有错误消息.

请让我知道这是如何工作的.

c switch-statement or-operator

6
推荐指数
2
解决办法
3万
查看次数

标签 统计

c ×1

or-operator ×1

switch-statement ×1