# Relational Operators

Posted on 02nd May 2013

Relational operators or comparison operators compare two operands which are on the left and right side of the operator. The result of such a comparison operation will be either TRUE or FALSE. Relational operators available in C are :

OperatorMeaning
==Equal To - Left side and right side operands are same
!=NOT Equal To - Left side and right side operands are different
>Greater Than - Left side operand is greater than right side
<Less Than - Left side operand is less than right side
>=Greater Than or Equal To - Left side operand is greater than or equal to right side
<=Less Than or Equal To - Left side operand is less than or equal to right side

Relational operators are generally used with conditional statements in C such as if, while, for.

### Example

Consider three variable a, b and c as below

```a = 10;
b = 15;
c = 10;```

The table below shows some expressions using above variables and the results.

ExpressionMeaningResult
(a = c)a Equals cTRUE
(a < b)a Less Than bTRUE
(b >= c) b Greater Than or Equal To cTRUE
(a != c)a Not Equal To cFALSE
(a > b)a Greater Than bFALSE
(b <= c)b Less Than or Equal To cFALSE