Friday, August 30, 2013

Does C have boolean variable type?

No, C does not have a boolean variable type. One can use ints, chars, #defines or
enums to achieve the same in C.


#define TRUE 1
#define FALSE 0

enum bool {false, true};


An enum may be good if the debugger shows the names of enum constants when examining
variables.

No comments:

Post a Comment