Relational Operators

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.

yashan has written 69 articles

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>