Main.c:5:1: error: unknown type name 'bool'
bool zhi(int n){
^
Main.c: In function 'zhi':
Main.c:8:10: error: 'false' undeclared (first use in this function)
return false;
报错的意思:未知的类型名:‘bool’
在C语言标准(C89)没有定义布尔类型,所以会报错。而C99提供了一个头文件<stdbool.h>定义了bool,true代表1,false代表0。只要导入stdbool.h,就能非常方便的操作布尔类型了。
#include <stdbool.h>