C++ Operators

An operator is a symbol which tells compiler to take an action on operands and yield a value. The Value on which operator operates is called as operands. C++ supports wide verity of operators. Supported operators are listed below –

Operator

Explanation

Arithmetic Operators

Used for arithmetic operations

Relational Operators

Used for specifying relation between two operands

Logical Operators

Used for identifying the truth value of the expression

Bitwise Operators

Used for shifting the bits

Assignment Operators

Used for assigning the value to the variable

Misc Operators

-

Arithmetic Operators :

Consider that we have A = 20 and B = 10

Operator

Description

Example

+

Adds two operands or variables

A + B = 30

-

Subtracts second operand from the first

A – B = 10

*

Multiplies both operands

A * B = 200

/

Divides numerator by denominator

A / B = 2

%

After dividing the numberator by denominator remainder will be returned after division