Assignment Operators


Syntax


 assignment_expression:
  conditional_expression
  prefix_expression assignment_operator assignment_expression 
 
 assignment_operator:
        =  *=  /=  %=  +=  -=  <<=  >>=  &=  ^=  |= 

Notes

Assignment operators group right-to-left. The target of the assignment must be a modifiable lvalue. The type of the result is the type of the left operand, and the left operand is updated according to the assignment operator that is applied.

If both operands are of arithmetic type, the type of the right operand is converted to match the type of the left operand as required.

The expressions:

A op= B (where op is one of * / % + - << >> & ^ |) A = A op B

behave similarly, except that in the former expression A is evaluated once, whereas in the latter it is evaluated twice.