On this page
bool
Prev: stdbool.h | Up: stdbool.h | Next: limits.h
Rel: stdbool.h, stdint, stdbool & limits Guide
Ref: cppreference — bool
Tags: #public #prog #c #stdlib #stdbool #tier/core
Include
#include <stdbool.h>
Signature & Overview
bool /* macro for _Bool in C99-C17, keyword in C23 */
Boolean type holding only 0 (false) or 1 (true).
Notes & Pitfalls
- Standard boolean type (
bool,true,false): Requires#include <stdbool.h>in C99–C17; built-in keywords in C23.
Example
#include <assert.h>
#include <stdbool.h>
int main(void) {
bool ok = true;
assert(ok && !false);
}
Linked from
Related notes
- tuts/c/stdlib/stdbool Linked here; links to this page; shared tags: #c, #prog, #stdbool, #stdlib
- tuts/c/stdlib/limits Linked here; shared tags: #c, #prog, #stdlib
- tuts/c/stdlib/stdint_stdbool_and_limits Linked here; shared tags: #c, #prog, #stdlib
- tuts/c/stdlib/assert/assert shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/assert/static_assert shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/ctype/isalpha shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/ctype/isdigit shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/ctype/isspace shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/ctype/tolower shared tags: #c, #prog, #stdlib, #tier
- tuts/c/stdlib/errno/errno shared tags: #c, #prog, #stdlib, #tier