Operators An operators specifies an operation to be performed that yields a value. The variables, constant can be joined by various operators to form an expression. An operands is a data item on which an operator acts. S ome operators require two operands, while other act upon only one operands. C include a large number of operators that fall several different categories, which are as:-
Relational Operators Relational Operators are used to compare values of two expressions depending on their relation. An expression that contains relational operators is called relational expression. If the relation is true then the value of relational expression is 1 and if the relation is false then the value of expression is 0.The relational operators are:- < less than > greater than <= less than or equal to >= greater than or equal to == is equal to != is not equal to .
Relational expressions evaluate to the integer values 1 (true) or 0 (false). All of these operators are called binary operators because they take two expressions as operands Relational operator (==) is used to compare 2 values whether they are equal are not. If both values are equal, output is displayed as ” values are equal”. Else, output is displayed as “values are not equal”. Note : double equal sign (==) should be used to compare 2 values. We should not use single equal sign (=).
The following table shows all the relational operators supported by C language. Assume variable A holds 10 and variable B holds 20 then −