Documentation Index
Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
Use this file to discover all available pages before exploring further.
_Bool is a built-in unsigned integer type introduced in the C99 standard, designed specifically to represent boolean truth values. Unlike standard integer types, _Bool enforces strict boolean semantics at the language level: it is only capable of storing the values 0 or 1.
Syntax and Implicit Conversion
The most defining characteristic of_Bool is its implicit conversion rules. When any scalar value (integer, floating-point, or pointer) is assigned to a _Bool variable, the compiler automatically normalizes the value. Any non-zero value or non-null pointer evaluates to 1, while a zero value or null pointer evaluates to 0.
int or char types for boolean logic, where assigning a value like 256 to an 8-bit integer might truncate to 0.
Memory Representation
The C standard dictates that_Bool must be large enough to store the values 0 and 1. While the exact memory footprint is implementation-defined, sizeof(_Bool) is typically 1 byte (8 bits) on modern architectures. This is because 1 byte is the smallest individually addressable unit of memory for most CPUs.
The <stdbool.h> Abstraction
While _Bool is the native language keyword, C99 also introduced the <stdbool.h> header to provide a more conventional syntax that aligns with C++ and other modern languages. This header defines three macros that map directly to the _Bool type and its binary states.
Integer Promotion
Because_Bool is classified as an integer type, it is subject to standard integer promotion rules. When a _Bool is used in an arithmetic expression, it is promoted to an int before the operation is evaluated.
Master C with Deep Grasping Methodology!Learn More





