Relational Operators:


We often compare two quantities and depending on their relation, take certain decisions. For example, we may compare the age of two persons, or the price of two items, and so on. These comparisons can be done with the help of relational operators. We have already used the symbol ‘<’ meaning ‘less than’. An expression such as:
                                    a < b or 1 < 20

containing a relational operator is termed as relational expression. The value of a relational expression is either one   or zero. It is one if the specified relation is true and zero if the relation is false. For example:
                                    100< 200 is true
                                    200<100 is false


C supports six relational operators in all. These operators and their meanings are shown in table:


Previous                                                                                    Next

Powered by Blogger.