C++ operator is a symbol used to perform mathematical or logical manipulations. C++ language is rich with built-in operators. This tutorial describes various operators in C++.

Arithmetic Operators

Operator Description
+ Addition
- Subtraction
* Multiplication
/ Division
% Modulus

Increment and Decrement Operators

Operator Description
++ Increment
-- Decrement

Relational Operators

Operator Description
== Is equal to
!= It is not equal to
> Greater than
< Less than
>= Greater than or equal to
<= Less than or equal to

Logical Operators

Operator Description
&& The "and" operator performs a logical conjunction of two expressions.
(If both expressions evaluate as True, the result is true. If either expression evaluates to False, the result is false.)
|| The "or" operator performs a logical disjunction on two expressions.
(if either or both expressions evaluate to True, the result is true)
! It is "not" operator that performs logical negation on an expression.

Bitwise Operators

Operator Description
<< Binary Left Shift Operator
>> Binary Right Shift Operator
~ Binary One's Complement Operator
& Binary AND Operator
^ Binary XOR Operator
| Binary OR Operator

Assignment Operators

Operator Description
= Assign
+= Increment then assign
-= Decrement then assign
*= Multiply then assign
/= Divide then assign
%= Modulus then assign
<<= Left shift and assign
>>= Right shift and assign
&= Bitwise AND assign
^= Bitwise exclusive OR and assign
|= Bitwise inclusive OR and assign

Misc Operators

Operator Description
, Comma operator.
sizeof() It returns the size of a memory location.
& It returns the address of a memory location.
* Pointer to a variable.
? : Conditional Expression.

Found This Page Useful? Share It!
Get the Latest Tutorials and Updates
Join us on Telegram