So I\'m having issues with some code that I\'ve inherited. This code was building fine in a C-only environment, but now I need to use C++ to call this code. The header p
You can use C99's bool
:
#ifndef __cplusplus
#include
#endif
bool myBoolean; // bool is declared as either C99's _Bool, or C++'s bool data type.
Why should you use this?
For compatibility with other C99 code. _Bool
is commonly used in C99 Code, and is very useful. It also grants you the ability to have a boolean datatype without the need to typedef a lot of stuff, as behind the scenes, _Bool
is a datatype defined by the compiler.