Saturday 16 August 2014

Relational operator

Relational operator: - An operator that compare two operands.
There are some relational operators.
Operator

Example
Return type
==
It checks the two operands whether they are equal or not.
(A==B)
1 ->If equal
0 -> If not equal
!=
It checks the two operands whether they are equal or not.
(A!=B)
1 -> if equal
0  ->if not equal
> 
It checks the 1st operand is greater than 2nd operand or not.
(A>B)
1 ->if A is grater
0 -> if B is greater
< 
 It checks the 1st operand is smaller than 2nd or not.
(A<B)
1 ->if B is greater
0 ->if A is greater
>=
It checks the value of 1st operand is greater than or equal to the value of 2nd operand.
(A>=B)
1 ->if A is greater than or equal to B
0 -> B is greater
<=
It checks the value of 1st operand is smaller than or equal to the value of 2nd operand.
(A<=B)
1 -> if A is smaller  than or equal to B
0 ->A is greater



No comments:

Post a Comment