4.12 Boolean Type

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


Practical C++ Programming
Practical C Programming, 3rd Edition
ISBN: 1565923065
EAN: 2147483647
Year: 2003
Pages: 364

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net