1 #include<stdio.h>
 2 #include<stdbool.h>
 3 main()
 4 {
 5     bool b = 6>5;
 6     bool c = true;
 7     c = 4;//bool类型里非0数都是true,都会输出1 
 8     printf("b=%d,c=%d",b,c);
 9     return 0;
10 }

 

 

逻辑运算

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 三目运算符(尽量少用)和逗号运算符

 

 

 

 

 

 逗号运算符

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 多路分支

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

posted on 2023-02-21 23:26  在野武将  阅读(13)  评论(0编辑  收藏  举报