Here's all .h files I've included so far,but non have the definition of 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>
Which file does define bool
?
bool is just a macro that expands to _Bool . You can use _Bool with no #include very much like you can use int or double ; it is a C99 keyword. The macro is defined in <stdbool. h> along with 3 other macros.
A boolean is a data type in the C Standard Library which can store true or false . Every non-zero value corresponds to true while 0 corresponds to false . The boolean works as it does in C++. However, if you don't include the header file stdbool.
In C, Boolean is a data type that contains two types of values, i.e., 0 and 1. Basically, the bool type value represents two types of behavior, either true or false. Here, '0' represents false value, while '1' represents true value.
In C there is no predefined datatype as bool. We can create bool using enum. One enum will be created as bool, then put the false, and true as the element of the enum.
It's part of C99 and defined in POSIX definition stdbool.h.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With