What is the Operators in C++ ? with Free Table Explain

What is the Operators in C++ ???

An Operators is a symbol which is used by user for giving instruction to computer for doing certain mathematical or logical manipulations on one or more operands. Operands is the quantity on which an operation is to be performed. For Example:

3 + 6 = 9

In the above example, “+” is the operator for the operation called addition. Hence 3 an 6 both are operands used for doing that operations.

Types of Operators

In C++, we have 8 Types of Operators

1. Arithmetic Operator

These operators are used to perform basic arithmetic operations.

OperatorDescriptionExample
+Addition a + b
Subtraction a – b
*Multiplication a * b
/Division a / b
%Modulus a % b
++Increment ++a or a++
Decrement –a or a–

2. Relational Operator

These operators are used to compare two values.

OperatorDescriptionExample
==Equal to a = = b
!=Not Equal to a != b
>Greater than a > b
<Less than a < b
>=Greater than or equal to a >= b
<=Less than or equal to a <= b

3. Logical Operators

These operators are used to perform logical operations.

OperatorDescriptionExample
&&Logical ANDa && b
||Logical ORa || b
!Logical NOT!a

4. Assignment Operator

These operators are used to assign values to variables.

OperatorDescriptionExample
=Assigna = b
+=Add and assigna += b
-=Subtract and assigna -= b
*=Multiply and assigna *= b
/=Divide and assigna /= b
%=Modulus and assigna %= b
&=Bitwise AND and assigna &= b
|=Bitwise OR and assigna |= b
^=Bitwise XOR and assigna ^= b
<<=Left shift and assigna <<= b
>>=Right shift and assigna >>= b

5. Conditional Operator

This operator is used to evaluate a condition and return one of two values.

OperatorDescriptionExample
?:Ternarycondition ? expr1 : expr2

6. Comma Operator

This operator is used to separate two or more expressions.

OperatorDescriptionExample
,Commaa = (b = 3, b + 2)

6. Unary Operator

These operators operate on a single operand.

OperatorDescriptionExample
+Unary plus+a
Unary minus-a
++Increment++a or a++
Decrement–a or a–
!Logical NOT!a
&Address-of&a
*Dereference*a
sizeofSize ofsizeof(a)

8. Bitwise Operators

These operators are used to perform bit-level operations.

OperatorDescriptionExample
&Bitwise ANDa & b
|Bitwise ORa | b
^Bitwise XORa ^ b
~Bitwise NOT~a
<<Left shifta << 2
>>Right shifta >> 2

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top