Different types of operators available in C++ are:-
- Arithmetic operators - are +, -, *, / and % operator. % operator divide the second value from the first and return the remainder.
- Relational operators - are >, >=, <, <=, ==, !=. These operators compare two values and return the appropriate result.
- Logical operators - are && and ||. This operator evaluates two expression, and evaluation stops as soon as the true or false value of result is known.
- Unary operators - The unary operators operate on one operand- variable or constant. C++ provides the two unary operators ++ and -- for incrementing and decrementing variables. The increment operator add 1 to its operand while decrement operator subtracts 1. The operators can also be used either prefix or postfix operators.
No comments:
Post a Comment