因为在C语言标准(C89)没有定义布尔类型,所以会报错。
而C99提供了一个头文件<stdbool.h>定义了bool,true代表1,false代表0。只要导入stdbool.h,就能非常方便的操作布尔类型了。
<stdbool.h>
bool
true
false
stdbool.h
#include <stdbool.h>