在linux中,在c中使用bool-type时包括哪些头文件?
以下是我到目前为止包含的所有.h文件,但其中没有定义在linux中,在c中使用bool-type时包括哪些头文件?,c,boolean,C,Boolean,以下是我到目前为止包含的所有.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> #inc
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>
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
#包括
哪个文件定义了
bool
?它是中的一部分并在中定义。bool
只是一个扩展到\u bool
的宏。您可以使用\u Bool
而不使用\include
非常像您可以使用int
或double
;这是一个C99关键字
宏与其他3个宏一起在
中定义
定义的宏是
:宏扩展为bool
\u bool
:宏扩展为false
0
:宏扩展为true
1
:宏扩展为\u bool\u true\u false\u已定义
1
stdbool.h
这必须有效#包括
像我这样的人在这里复制和粘贴 tere是POSIX规范的最新版本。我只需像C99之前的每个人一样使用
int
),这只是重复现有的答案。这如何提供比其他5年前的答案更多的信息?@PrafullaKumarSahu它确实提供了一个答案(即使你认为这是低质量的)我注意到有两个答案,只是pmg答案的重复。