#how can int hunger = true;
14 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
that is an implicit conversion
false -> 0
true -> 1
so int hunger = true; it just means that hunger = 1?
yes
ints can be converted to bools too
if the int is zero you get false
for everything else, you get true
that would be (bool) hunger am I correct?
yes, this is a C-style cast, which will be replaced by static_cast<bool>(hunter)
Okay thanks for the help :D
the full list of available implicit conversions is long, this should be enough for you for now