Operator are symbols that act upto data. They represent a paticular operation to be performed on the data. Operators can be classified as arithmetical, relation, and assigning operators.
Arithmetical Operators : These types of operators denote mathematical operators like – Add, Subtract, Multiple, Divide and Exponentiation.
Operator Function
+ Addition
- Subtraction
/ Division
* Multiplication
^ Exponentiation
% Mod (Remainder of a division)
/ Division
* Multiplication
^ Exponentiation
% Mod (Remainder of a division)
Special Arithmetical Operators : The - - and + + are known as decrement and increment operators.
For example :
x = x + 1;
is equivalent to
++x; or x ++;
Also
x = x – 1;
is equivalent to
- - a; or a - -;
Relational Operator : These operator are used to compare two values on the basis of a certain condition.
Operator Function
< Less than
<= Less than or equal to
> Greater than
>= Greater than or equal to
!= Not equal to
= Equal to
Logical Operators : The logical operators are :
Operators Function
&& AND
|| OR
! NOT
Assigning Operator : The assigning operators are :
Operators Function
= Assign a value
+ = Add the values and
assign it to the left
- = Sudtract the values
and assign it to the left
* = Multiply the values
and assign it to the left
/ = Divide the values and
assign it to the left
% = Find the remainder and assign it to the left
Bitwise Operators : The Bitwise Operators are applicable to the char and int data types only .These operators are not useful with float, double, long double, void or other complex data types.
0 comments:
Post a Comment