There are basically five types of operators i.e
1. Arithmetic Operators
2.Assignment Operators
3.Relational Operators
4.Logical Operators
5.Increment and Decrement Operators
Arithmetic Operators:-
Following arithmetic operators are used in C.
+ addition
- subtraction
* multiplication
/ division
% modulus
Assignment Operators:-
Assignment operators is used to assign the value to the variable.
e.g num=11 .
in this case num is variable which has assigned a value 11 using assignment operator "=".
Relational Operators:-
Relational Operators are use to compare two values of the same type, in C language there six types of relational operators.
= = equal to
! = not equal to
< less than
> greater than
<= less than or equal to
>= greater than or equal to
Logical Operators:-
There are three logical operators in C.
! NOT
&& AND
|| OR
Increment or Decrement Operator:-
These operators are used to increase or decrease a specific value.
++ increment by 1
- - decrement by 1
e.g a=a+1 or a=a++
Note :-
You may notice that "=" is assignment operator and "==" is relational operator. the basic difference between them is that that "=" is use to save or assign one value to a variable while "==" is used to compare two same types of variables in C.
No comments:
Post a Comment