An operator is a symbol that tells the computer to perform certain mathematical and logical manipulations. Operators are used in programs to manipulate data and variables. They are used for mathematical and logical operations. The data and variables that the operator operates are called operands.
Types of operators
Based on the number of operands they take:
- Unary Operator – Operators that take only one operand. For example: pre-increment operator (++x), unary minus operator (-).
- Binary Operator – Operators that take two operands. For example: binary plus operator(x+y), logical AND operator(x&&y).
- Ternary Operator – OPerators that take three operands. For example:
Based on nature:
- Arithmetic Operator
- Relational Operator
- Logical Operator
- Assignment Operator
- Increment and decrement Operator
- Conditional Operator
- Bitwise Operator
- Special Operator
We will discuss these operators individually on a separate topic.