Blog Datasheets Home About me Clients My work Services Contact

G2Labs Grzegorz Grzęda

libc - stdbool header

June 23, 2023

Definition of bool type in C. Platform dependant implementation, but has to allow standard logical operations in C to carry on. Note: according to ANSI C standard logical operators result in (int) 0 or (int) 1 values.

1
#include <stdbool.h>

Defined types

bool as the type to process boolean operations.

Macro definitions

true as 1.

false as 0.

__bool_true_false_are_defined as 1 - indicates that the boolean foundation is present.

Possible implementation

1
2
3
4
5
typedef int bool;
#define true 1
#define false 0

#define __bool_true_false_are_defined 1


➡️ Refactoring legacy code using clean code principles in C and Python


⬅️ libc - stddef header


Go back to Posts.