Assignment Operator In C++

Assignment Operators ?

An assignment operator in java is the operator used to assign a new value to a variable, property, event or indexer element in java programming language.

Assignment operators can also be used for logical operations such as bitwise logical operations or operations on integral operands and Boolean operands.


➦The copy assignment operator, often just called the "assignment operator", is a special case of assignment operator where the source (right-hand side) and destination (left-hand side) are of the same class type.


Assignment Operators

Operator Description
= Assign
+= Increments, then assigns
-= Decrements, then assigns
*= Multiplies, then assigns
/= Divides, then assigns
%= Modulus, then assigns
<<= Left shift and assigns
>>= Right shift and assigns
&= Bitwise AND assigns
^= Bitwise exclusive OR and assigns
|= Bitwise inclusive OR and assigns

Example 1:



Output :

= Output: 10
+= Output: 20
-= Output: 10
*= Output: 100
/= Output: 10
%= Output: 0/code>

Example 2:



Output :

  
14
16

Example 3:



Output :

13
9
18
9
16