true C · 常用常量
stdbool.h 定义的布尔真宏,值为 1。
怎么用
bool b = true;
小例子
#include <stdio.h>
#include <stdbool.h>
int main(void) {
bool b = true;
if (b) printf("真");
return 0;
}
运行结果
输出 真
提醒:需要包含 <stdbool.h>;底层仍是整数 1
在代码里遇到不认识的词?打开代码点读机,点一下就懂 → ← C全部词条