Assignment Operators in C Language

Operators Definition

As studied earlier, Operators are the symbols, which performs operations on various data items known as operands. For Example: in a a+b, a and b are operands and + is an operator.

Note:- To perform an operation, operators and operands are combined together forming an expression. For example, to perform an addition operation on operands a and b, the addition(+) operator is combined with the operands a and b forming an expression.


Relational Operators

Relational operators ar eused to find out the relationship between two operands.

The various relational operators provided by C are less then '<', less than or equal to '<=', greater than '>', greater than or equal to '>=', equal to '==' and not equal to '!=' operators.

Operator Description Example
== Checks if the values of two operands are equal or not. If yes, then the condition becomes true. (A == B) is not true.
!= Checks if the values of two operands are equal or not. If the values are not equal, then the condition becomes true. (A != B) is true.
> Checks if the value of left operand is greater than the value of right operand. If yes, then the condition becomes true. (A > B) is not true.
< Checks if the value of left operand is less than the value of right operand. If yes, then the condition becomes true. (A < B) is true.
>= Checks if the value of left operand is greater than or equal to the value of right operand. If yes, then the condition becomes true. (A >= B) is not true.
<= Checks if the value of left operand is less than or equal to the value of right operand. If yes, then the condition becomes true. (A <= B) is true.

Example:



Output:

 a is less than b
 c and d both are equal
 a and b are not equal


Read Also