An operator is the part of an instruction that specifies the value to be operated on. An operator also carries out a specific operation on its operands. Examples of operators are +, -, *, /, and %. Operators can be categorized based on the type of operations carried out and the number of operands acted upon by the operator.
Based on the type of operations carried out by the operator, we can classify operators into:
- Relational operators
- Assignment operators
- Logical operators
- Arithmetic operators
- Bitwise operators
Operator type |
Examples |
Relational operators |
>, <, >=, <=, == |
Assignment operators |
+=, -=, *=, /=, = |
Logical operators |
&&, ||, ! |
Arithmetic operators |
+, -, *, / |
Bitwise operators ... |