Search Placementyogi.com
 

Relational Operators in C

The relational operator is also called compare operators are used to compare two operands. The two operands may be constants, variables or expressions. After comparing two operands it gives the result in true (always 1) or false ( always 0).

The relational operator and the meaning associated with them are shown in below table.

Operator Meaning       Description Example
== Equal Checks if the value of two operands is equal or not, if yes then condition becomes true. (5 == 7) is false
!= Not equal Checks if the value of two operands is equal or not, if values are not equal then condition becomes true. (5 != 7) is true.
> Greater Than Checks if the value of left operand is greater than the value of right operand, if yes then condition becomes true. (5 > 7) is false
< Less than Checks if the value of left operand is less than the value of right operand, if yes then condition becomes true. (5 < 7) is true.
>= Greater than or equal Checks if the value of left operand is greater than or equal to the value of right operand, if yes then condition becomes true. (5 >= 7) is false
<= Less than or equal Checks if the value of left operand is less than or equal to the value of right operand, if yes then condition becomes true. (5 <= 7) is true.
Banner to LogicGuns.com

Hide Page Information
Relational Operators in c