Executable C statements either perform actions (such as calculations or input or output of data) or make decision. Using relational operators we can compare two variables in the program. The C relational operators are summarized below, with their meanings. Pay particular attention to the equality operator; it consists of two equal signs, not just one. This section introduces a simple version of C’s if control structure that allows a program to make a decision based on the result of some condition. If the condition is true then the statement in the body of if statement is executed else if the condition is false, the statement is not executed. Whether the body statement is executed or not, after the if structure completes, execution proceeds with the next statement after the if structure. Conditions in the if structure are formed with the relational operators which are summarized in the Table below:
| Relational Operator | Condition | Meaning |
|---|---|---|
| == | x == y | x is equal to y |
| != | x != y | x is not equal to y |
| < | x < y | x is less than y |
| <= | x <= y | x is less than or equal to y |
| > | x > y | x is greater than y |
| >= | x >= y | x is greater than or equal to y |
Relational operators usually appear in statements which are inquiring about the truth of some particular relationship between variables. Normally, the relational operators in C are the operators in the expressions that appear between the parentheses. For example,