Skip to content

Relational Operators

by yashan on August 10th, 2011

In C programming language Relational Operators are used to create logical relationship between two operands. Relational operators are used for comparison purpose. The expression having two operands and one relational operator is called relational expression.Following are the relational operators used in C programming language -

Operator Meaning
< Less than
<= Less than and equal to
> Greater than
>= Greater than and equal to
== equal to
!= not equal to

If a = 5 & b = 2 are two integer type variables, then using relational expressions the various results will be as follows -

Relational Expression Result
a>b True
a>=b True
a<b False
a>=b False
a==b False
a!=b True

These operators are mostly used with if and else if statements. You will learn about if and else if statements if the further chapters.

From → C Tutorials

No comments yet

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS