Namespaces
Variants

Boolean type

From cppreference.com

When any scalar value is converted to _Bool, the result is 0 if the value compares equal to 0; otherwise, the result is 1.

Notes

NaNs do not compare equal to 0 and thus convert to 1.

Example

#include <stdio.h>

int main(void)
{
    _Bool a = 0.0;
    _Bool b = 8;
    _Bool c = 0.0/0.0;

    printf("%d\n", a);
    printf("%d\n", b);
    printf("%d\n", c);

    return 0;
}

Possible output:

0
1
1