The bool
type represents boolean logical quantities. The possible values of type bool
are true
and false
.
No standard conversions exist between bool
and other types. In particular, the bool
type is distinct and separate from the integral types, and a bool
value cannot be used in place of an integral value, nor vice versa.
In the C and C++ languages, a zero integral value or a null pointer can be converted to the boolean value false
, and a non-zero integral value or a non-null pointer can be converted to the boolean value true
. In C#, such conversions are accomplished by explicitly comparing an integral value to zero or explicitly comparing an object reference to null
.