Skip to content

Boolean#

Since the C23 standard, the C programming language has the data type bool for storing Boolean values. It is guaranteed to be large enough to hold one of the two values true or false:

bool example = true;
example = false;

Typically, a boolean is 8 bits, but this is not guaranteed.

In practice, bool is not used often. Instead, integers are used with \(0\) being treated as false and everything else as true.