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.
#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.
And also read
- Do Global variables start out as zero?
- Does C have boolean variable type?
- Where may variables be defined in C?
- To what does the term storage class refer? What are auto, static, extern, volatile, const classes?
- What does the typedef keyword do?
- What is the difference between constants defined through #define and the constant keyword?
- What are Trigraph characters?
- How are floating point numbers stored? Whats the IEEE format?
- When should a type cast be used?
- Can structures be assigned to variables and passed to and from functions?
No comments:
Post a Comment