Operator and operand , what is Operator and operand
x+y
+ is a operater
and xy is a operand
Operator
It is a special symbol which is used to perform logical or mathematical operation on data or variable.
Operand
It is a data or variable on which the operation is to be performed.
Types of Operator
⇒Arithmetic Operators
⇒Relational Operators
⇒Logical Operators
⇒Assignment Operators
⇒Bitwise Operators
⇒Increment/Decrement Operators
⇒Conditional Operators
⇒Special Operator
Arithmetic operators:
Operator | Description |
+ | Addition |
− | Subtraction |
* | Multiplication |
/ | Division |
% | Modulus |
int a = 2;
int b = 3;
printf("a + b = %d\n", a+b);Relational Operators:
Operator | Description |
> | Greater than |
< | Less than |
>= | Greater than or equal to |
<= | Less than or equal to |
== | Is equal to |
!= | Is not equal to |
int a = 2;
int b = 2;
printf("a == b = %d\n", a==b);Logical Operators:
Symbol | Operator |
&& | AND operator |
|| | OR Operator |
! | NOT Operator |
Bitwise Operators:
Symbols | Operators |
& | Bitwise AND |
| | Bitwise OR |
^ | Bitwise XOR |
~ | Bitwise complement |
<< | Shift left |
>> | Shift right |
Assignment Operators:
Operator | Description |
= | Assigns values from right side operands to left side operand |
+= | It adds the right operand to the left operand and assign the result to the left operand. |
-= | It subtracts the right operand from the left operand and assigns the result to the left operand. |
*= | It multiplies the right operand with the left operand and assigns the result to the left operand. |
/= | It divides the left operand with the right operand and assigns the result to the left operand. |
Comments
Post a Comment