Operators in C ++
What are Operators and Operands –
The operations being carried out on data, are represented by operators.
and the data/object on which operation is to be applied is referred as operands.
Example of Operators and Operands :
Consider an expression [(m+n)(e-7)] , where m,n,e are operands or data or objects and +,-, are operators in C++.
Operators in C joins variables and constants to form expressions.
Different Types of Operators :
C++ is very rich in built-in operators. Different classes of operators in C++ are –
- Arithmetic operators – These are further divided into two classes again which are –
- Unary operators (+ -) and
- Binary operators. (+ – / * %)
- Increment/decrement operators – These are divided into –
- Post Increment
- Pre Increment
- Relational operators
- Logical operators
- Bit wise operators
- Conditional (ternary) operators
- Other operators
- Assignment_operators (or) c++ shorthands
Click on the operator below, for its detailed description with C++ programs.
|S.no||Types of Operators||Description|
|1||Arithmetic operators||Performs maths calculations like addition(+), subtraction(-), division(/), multiplication(*) and modulus(%)|
|2||Increment/decrement operators||Used to either increase or decrease the operand value of the variable by one.|
|3||Relational operators||Performs comparison of value of two variables. These operators establish relationships among the values.|
|4||Logical operators||Performs logical operations on the given two variables. It tells how the relationships among values can be connected.|
|5||Bitwise operators||Performs bit operations on given two variables.|
|6||Conditional (ternary) operators||Ternary operator returns one value if condition is true and returns another value if condition is false.|
|7||Other operators||&, *, sizeof( ), comma (,).|
or c++ shorthands
|used to assign the values for the variables in C++ programs.|
|Variables and Constants in C++ (Day7)||Expressions in C++ (Day10)|