What is Relational Operators in C programming language ?

Today I will discuss about Relational Operator in C language there are some following points which are discuss in this article:
  • What is relational operator in C language ?
  •  What is Relational operator complement ?

What is Relational Operators in C language ?

1.Relational Operators in C

We often compare two quantities and depending on their relation,take a certain decisions.For example if we want to compare height of two children, or the marks of the two students and so on.These comparisons can be done with help of relational operator.We may already use the symbol '<' meaning less than. An expression such as
a<b or 1<6.
Containing  a relational operator is termed as a relation expression.The value of a relational expression is either one or zero.It is the specified relation is true and zero if the relation is false.

C language supports six types of relational operators:
  • <   (is less then)
  • <= (is less than or equal to)
  • >   (is greater than)
  • >= (is greater or equal to)
  • == (is equal to)
  • !=  (is not equal to)
A simple relational expression contains only one relational operator and takes the following form:
                    ae-1 relational operator ae-2
ae-1 and ae-2 are the arithmetic expression may be simple, words,constant,variable or combination of them for example:

4.5<=10---True
4.5<-10---False

Note: Relational expression are used in decision making statement such as if and while to decide the course of action of of a running program.

Relational Operator Complement in C

Among the six relational operator,each one is a complement of another operator:

> is a complement of <=
< is a complement of >=
== is a complement of !=

Conclusion:
 
In this text we have learned about What is relational operator and complement of relational operator,i hope you have no any doubt left in this topic but if you have then feel free comment below.

Post a Comment (0)
Previous Post Next Post