A Boolean type (BOOL) is a new basic data type added by C + +. The bool type is not defined in the standard C language, and if you need to use the bool type,
A programmer can customize a bool type by defining a macro definition statement as follows:
#define BOOL INT
#define FALSE 0
#define TRUE 1
That is, the int type is defined as bool, and the int type 0 and 12 values are defined as two values of type bool, true and false.
But in C + + it doesn't have to be so cumbersome, and C + + has a definition of bool type.
The bool type is one of the basic data structures of the C + + language, where the compiler gcc 4.8.1 and Visual C + + 2012 assign a 1-byte length to the BOOL type variable on the 80x86 processor.
The bool type takes a value range of only two values: True and False. When you do a logical operation, the default nonzero is ture.
Defining a BOOL type variable is also similar to the definition of other basic data type variables, as follows:
BOOL flag = TRUE;
C + + Learning 1-bool data types