C99 布尔数据类型? [英] C99 boolean data type?
本文介绍了C99 布尔数据类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
什么是 C99 布尔数据类型以及如何使用它?
What's the C99 boolean data type and how to use it?
推荐答案
Include <stdbool.h>
标题
Include <stdbool.h>
header
#include <stdbool.h>
int main(void){
bool b = false;
}
宏true
和false
分别扩展为1
和0
.
Macros true
and false
expand to 1
and 0
respectively.
Section 7.16
布尔类型和值
Section 7.16
Boolean type and values < stdbool.h >
- 1 标题
定义了四个宏. - 2 宏
- 布尔扩展为 _Bool.
- true : 展开为整数常量 1,
- false:扩展为整数常量 0,和
- __bool_true_false_are_defined它扩展为整数常量 1.
这篇关于C99 布尔数据类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文