Home Contact About

Relational Operators

In C programming, relational operators are used to compare two values or variables and return a Boolean value of either true or
false. There are six relational operators in C, and they are:

  1. Greater than (>):
    This operator checks if the value on the left side is greater than the value on the right side.
  2. Less than (<):
    This operator checks if the value on the left side is less than the value on the right side.
  3. Greater than or equal to (>=):
    This operator checks if the value
    on the left side is greater than or equal to the value on the right side.
  4. Less than or equal to (<=):
    This operator checks if the value on the left side is less than or equal to
    the value on the right side.
  5. Equal to (==):
    This operator checks if the value on the left side is equal to the value on
    the right side.
  6. Not equal to (!=):
    This operator checks if the value on the left side is not equal to the value
    on the right side.
  7. Relational operators are commonly used in decision-making statements like if,
    while, and for loops to control the flow of a program. Understanding these operators
    is essential for creating effective and efficient C programs.