The if keyword is used to make decisions based upon simple comparisons.
Here's the basic format:
if(evaluation)
{
statement;
}
The evaluation is a comparison, a mathematical operation, the result of a function or some other condition.
If the condition is true, the statements (or statement) enclosed in braces are executed; otherwise, they're skipped.
The if statement's evaluation need not be mathematical. It can be a function that returns a true or false value; for example:
if(ready())
Any non-zero value is considered true in C. Zero is considered false. So this statement is always true:
if(1)
And this statement is always false:
if(0)
When only one statement belongs to an if statement, the braces are optional.