devxlogo

Boolean Conversion

Boolean Conversion

Numeric values and pointers are implicitly converted to a Boolean value in conditional expressions. For example:

 void *p = get_ptr();if(p){ // process p}

A zero value evaluates as false. All other values evaluate as true. Note that negative values also evaluate as true.

devx-admin

Share the Post: