1. Home
  2. Computing & Technology
  3. C / C++ / C#

Definition of Bool

By David Bolton, About.com

Definition: Bool is a fundamental type in C, C++ and C# languages.

Variables of this type can only take two values- 1 and 0. In C++ these correspond to true and false and can be used interchangably. In C# bool variables can only use true and false, they are not interchangeable with 1 and 0.

Boolean variables can be packed together to save memory space. An understanding of binary can be a useful skill.

Note Because of the way false and 0 are usually treated the same (except in C#), any non zero value is the same as true, not just 1.

Glossary:

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Also Known As: Boolean
Examples:
Using a bool and checking for true/false improves readability of your program
Explore C / C++ / C#
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. C / C++ / C#
  4. Getting Started
  5. Bool - Definition

©2009 About.com, a part of The New York Times Company.

All rights reserved.