©
This document usesPHP Chinese website manualRelease
C编程语言(从C99开始)支持使用内置类型_Bool的布尔运算(请参阅_Bool)。 当包含头文件
标准逻辑运算符&&,||,!可以以任何组合的布尔类型一起使用。
一个程序可能会取消定义,然后可能重新定义这些宏bool,true并且false。
|
宏名称 |
扩展到 |
|---|---|
|
bool |
_Bool |
|
true |
整数常量1 |
|
false |
整数常量0 |
|
__bool_true_false_are_defined |
整数常量1 |
#include#include int main(void){ bool a=true, b=false; printf("%d\n", a&&b); printf("%d\n", a||b); printf("%d\n", !b);}
可能的输出:
011
| 用于bool的C ++文档 |