how to use bool function in c???
Printable View
how to use bool function in c???
There is no 'boolean' type in C89, at least not until C99 stdbool.h
If you don't want to use stdbool.h you can define your own (convention has it, true = 1, false = 0).
What do you mean by bool "function"?
bool is true false.
In C, you can just define it, as zacs7 suggested.
Code:#define TRUE 1
#define FALSE 0
I like:
But I am still new to C. I think the advantage with this method is that it allows you to declare a variable like:Code:typedef enum BOOL {
FALSE,
TRUE
} BOOL;
BOOL done = FALSE;
Instead of:
int done = FALSE;
Am I missing any other differences between #define and typedef for a bool type?