Switch case with logical operator in C

前端 未结 5 1902
借酒劲吻你
借酒劲吻你 2021-01-12 20:59

I am new to C and need help. My code is the following.

 #include  
 #include  
 void main()
 {

  int suite=2;  

  switch(suit         


        
5条回答
  •  一整个雨季
    2021-01-12 21:28

    case 1||2:
    

    Becomes true. so it becomes case 1: but the passed value is 2. so default case executed. After that your printf("I thought somebody"); executed.

提交回复
热议问题