您包括在Linux中的c语言中使用bool类型的哪个头文件?

问题描述

| 这是我到目前为止已包含的所有.h文件,但没有
bool
的定义:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <sys/types.h>
#include <sys/socket.h>
#include <pthread.h>
#include <netdb.h>
#include <fcntl.h>
#include <unistd.h>
#include <event.h>
哪个文件定义“ 0”?     

解决方法

它是C99的一部分,在POSIX定义stdbool.h中定义。     ,
#include <stdbool.h>
对于像我这样的人,请在此处复制和粘贴。     ,
bool
只是扩展为
_Bool
的宏。您可以使用
_Bool
而不使用
#include
,就像您可以使用
int
double
一样;它是一个C99关键字。 宏与其他3个宏一起在
<stdbool.h>
中定义。 定义的宏是
bool
:宏扩展为
_Bool
false
:宏扩展为
0
true
:宏扩展为
1
__bool_true_false_are_defined
:宏扩展为
1
    ,在代码中尝试此头文件
stdbool.h
这必须工作     

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...