ABSTRACT

The if statement controls program flow based on whether a condition evaluates to true or false. The simplest form of if statement is

if(condition) { … /* block of statements. */

}

If the value of the condition is true, the block of statements between the braces will be executed. For example,

int x = 3; if(x != 0) { printf("x isn’t zero\n");

}

Since x is not 0, the value of the if condition is true and the program displays x isn’t zero.