0

BOOL

When initializing a boolean variable, do you use the keywords TRUE or FALSE only, or can you use the integers 1 and 0? What are the pros and cons of initializing with the keywords and what are the pros and cons of initializing using the integers?

15th Sep 2022, 9:08 AM
zighetamara
1 Answer
0
There's no pros nor cons We can assign booleam literals -> true or false. We can assign integers -> anything non zero are considered true, a zero is considered false. We can even assign floating point value although it's not recommended due to floating point precision issue. We can assign a result from expression evaluation -> age >= 17, weight < 75, height >= 170 etc.
15th Sep 2022, 10:04 AM
Ipang