Operators in C++
Notes:
Operators in C++ Programming Language :
Expression:
- is a valid combination of operators and operands, on evaluation it yields a result
Ex: 2 + 2, 10 – 2 etc.
Operator:
- is a symbol which performs an operation on the given operand(s)
Operand:
- is a value on which an operator performs an operation
Operators in any programming language are broadly categorized into
Unary Operators: accept only one operand.
Binary Operators: accept two operands.
Ternary Operators: accept three operands
Types of C++ Operators: LARA BICS
- C++ provides rich set of operators to perform arithmetic, logical, comparison, etc.
L – Logical Operators : ( &&, || , ! )
A – Arithmetic Operators : ( +, -, *, /, % )
R – Relational Operators : ( <, >, <=, >=, ==, != )
A – Assignment Operators : ( = )
-Short Hand Assignment: ( +=, -=, *=, /=, %=, &=, |=, ^=, <<=, >>= etc. )
B – Bitwise Operators : (&, |, ~, ^ )
- Bitwise Shift: ( <<, >> )
I – Increment and Decrement Operators : (++ , --)
C – Conditional Operator : (?:)
S – Special Operators : ( sizeof , &, *, **, ::, ::*, ->*, .*, Comma, Dot, ->, (type), new, delete, endl, setw etc. )