An if statement in C++ accepts one condition. That condition can be made up of several expressions using the logical AND/ORs (&& and/or ||). Each expression is evaluated and combined with the other expressions using the logical operators.
An expression is
typically written like to [/code](a == b)[/code]. This will evaluate to either a true false, depending on if a is equal to be. C++ has made it easier on us when checking boolean expressions. If you want to check to see if
(myVariable == true)
you can simply write
if (myVariable)
. When a variable (or anything else) exists as an expression, it gets evaluated first (functions are called if they're used, etc.) and then the return value is evaluated (the value returned by the function, etc).
If the value can be expressed as true/false, that is the value the expression returns. If it can be expressed as a number, any non zero number is true, 0 is false. If it's a string, I believe
is evaluated as false, everything else is evaluated as true. NULL pointers are false, all other pointers true.
Anything I'm wrong on, please correct me.