Assignment operators are used to assign the result of an expression to a variable. The most commonly used assignment operator is (=). 

eg: i=i+10; 

i=i+10 is an assignment expression which assigns the value of i+10 to i. 

Expression like i=i+10, i=i5, i=i*2 etc. can be rewritten using shorthand assignment operators. 

e.g.: i=i+5 is equivalent to i+=5 
i=i*(y+1) is equivalent to i*=(y+1) 

Operator Precedence: 

While executing an arithmetic statement which has two or more operators, we may have some problems about how exactly does it get executed. 

To answer these questions satisfactorily we have to understand the precedence of operators. 

Precedence defines the sequence in which operators are to be applied on the operands. Operators of same precedence are evaluated from left to right or right to left, depending upon the level. 

This is known as associativity property of an operator. 

Summary of precedence of associativity is given below: 

Description 
Operator 
Associativity 
Function Expression 
( ) 
Left to Right 
Array Expression 
[ ] 
Left to Right 
Structure Operator 
> 
Left to Right 
Structure Operator 
. 
Left to Right 


Description 
Operator 
Associativity 
Unary minus 
 
Right to Left 
Increment/Decrement 
++/ 
Right to Left 
One's Compliment 
~ 
Right to Left 
Negation 
! 
Right to Left 
Address of 
& 
Right to Left 
Value at address 
* 
Right to Left 
Type cast 
(type) 
Right to Left 
Size in bytes 
sizeof 
Right to Left 


Description 
Operator 
Associativity 
Multiplication 
* 
Left to Right 
Division 
/ 
Left to Right 
Modulus 
% 
Left to Right 
Addition 
+ 
Left to Right 
Subtraction 
 
Left to Right 


Description 
Operator 
Associativity 
Left Shift 
<< 
Left to Right 
Right Shift 
>> 
Left to Right 


Description 
Operator 
Associativity 
Less Than 
< 
Left to Right 
Less Than Equal to 
<= 
Left to Right 
Greater than 
> 
Left to Right 
Greater than Equal to 
>= 
Left to Right 


Description 
Operator 
Associavity 
Equal to 
== 
Left to Right 
Not equal to 
!= 
Left to Right 


Description 
Operator 
Associavity 
Bitwise AND 
& 
Left to Right 
Bitwise XOR 
^ 
Left to Right 


Description 
Operator 
Associavity 
Bitwise OR 
^ 
Left to Right 


Description 
Operator 
Associavity 
Logical AND 
&& 
Left to Right 
Logical OR 
 
Left to Right 


Description 
Operator 
Associavity 
Conditional 
?: 
Right to Left 


Description 
Operator 
Associavity 
Assignment 
= 
Right to Left 
Assignment 
*= /= %= 
Right to Left 
Assignment 
+= = &= 
Right to Left 
Assignment 
^= = 
Right to Left 
Assignment 
<<= >>= 
Right to Left 


Description 
Operator 
Associavity 
Comma 
, 
Right to Left 


