If an "if" is used in the following way what does it do?
Code:if(variable_name)
{
// What to do.
}
Printable View
If an "if" is used in the following way what does it do?
Code:if(variable_name)
{
// What to do.
}
variable_name is converted to bool, and then the check for true/false happens.
So it looks if the variable is set?
No. It converts the variable to type bool. What exactly that means depends on the type of the variable, and its value, e.g., a null pointer is converted to false, but a non-null pointer is converted to true.Quote:
Originally Posted by Kitt3n