Practical C Programming, 3rd Edition

I l @ ve RuBoard

The bool type can hold the value true or false . For example:

bool flag; /* Flag can be on or off */ flag = true;

This type of variable is extremely useful when dealing with logic statements, as described in Chapter 6.

Legacy Boolean Types

Until recently the C language did not have a bool [4] type. Because of this, people used macros and the typedef statements to define their own boolean type. Most of the time they called it BOOL , or sometimes Bool .

You may see these types in old (and not so old) programs. These names are depreciated and should not be used in current C++ programs.

[4] Yes, C does have a bool type. See the C standard: ISO/IEC 9899:1999(E) section 7.16.

I l @ ve RuBoard

Категории