#include <stdbool.h>

_Bool

前面有下划线,起到表示逻辑成立或者不成立。

 1 #include<stdio.h>
 2 #include<stdbool.h>
 3 
 4 main()
 5 {
 6     _Bool bl, bl1;
 7     
 8     bl = true;
 9     bl1 = false;
10 
11     printf("b=%d
", bl);
12 
13     printf("size=%d
", sizeof(bl));
14 
15     printf("b=%d
", bl1);
16 
17     printf("size=%d
", sizeof(bl1));
18 }

用于判断,ture为1,false为0

 1 #include<stdio.h>
 2 #include<stdbool.h>
 3 
 4 main()
 5 {
 6     _Bool bl = 5 > 3;
 7 
 8     if (bl)
 9     {
10         printf("yes
");
11     }
12     else
13     {
14         printf("no
");
15     }
16 
17     getchar();
18 }
原文地址:https://www.cnblogs.com/denggelin/p/5459413.html