Basic and Advance C Question: Download Questions PDF
Should I use symbolic names like TRUE and FALSE for Boolean constants, or plain 1 and 0?
Answer:
It's your choice. Preprocessor macros like TRUE and FALSE (and, of course, NULL) are used for code readability, not because the underlying values might ever change. It's a matter of style, not correctness, whether to use symbolic names or raw 1/0 values.
On the one hand, using a symbolic name like TRUE or FALSE reminds the reader that a Boolean value is involved. On the other hand, Boolean values and definitions can evidently be confusing, and some programmers feel that TRUE and FALSE macros only compound the confusion.
On the one hand, using a symbolic name like TRUE or FALSE reminds the reader that a Boolean value is involved. On the other hand, Boolean values and definitions can evidently be confusing, and some programmers feel that TRUE and FALSE macros only compound the confusion.
Download C Programming Interview Questions And Answers
PDF
Previous Question | Next Question |
What is Hungarian Notation? Is it worthwhile? | If NULL and 0 are equivalent as null pointer constants, which should I use? |