# Assignment Operators in C

Last Updated Nov 1, 2015, 07:00:14 PM

Assignmentment operator is used t assign a value to a variable, or to an event. For example, ` int x = 3;` In this statement the value 3 is assigned to a variable x. Assignment operators are also used to perform logical operators such as boolean operands, integral operands

The below table lists all the assignment operators available in C programming.

Operator Description Example Try It Now
= (Assignment Operator) It is used to assign a value from right side operand to left side operand. If `x = 2 + 3` the total value of 2+3 will be assigned to the variable 'x'
+ = (Add AND Assignment Operator) It is used to add the right operand to the left operand and assign the result to the left If `z += y` then z becomes ` z = z + y`
- = (subtract AND Assignment Operator) It is used tosubtract the right operand to the left operand and assign the result to the left If `z -= y` then z becomes ` z = z - y`
* = (multiply AND Assignment Operator) It is used multiply the right operand with left operand and assign the result to the left operand If `z *= y` then z becomes ` z = z * y`
/= (divide AND Assignment Operator) It basically divides the left operand with right operand If `z /= y` then z becomes ` z = z / y`
%= (modulus AND Assignment Operator) It actually takes the modulus using two operands and assigns the result to the left If `z %= y` then z becomes ` z = z & y`
<<= Left shift AND assignment If `z <<= 44` is also can be write as ` z = z << 44`
>>= Right shift AND assignment If `z>>= 44` is also can be write as ` z = z >> 44`

### Example of Assignment Operators

Other Operators you might want to learn

C-Operators

Arithmetic Operators

Logical Operators

Relational Operators

Difference between Static and Global Variables- StackOverFlow