Operators used to assign the result of expression to a variable. The usual assignment operator is ‘=’ symbol. In addition ‘C’ has a set of shorthand assignment operators of the form.
Variable operator = value.
Example:-
Assignment Operator
|
Short hand operator
|
a = a+1
|
a+ =1
|
a = a-1
|
a- =1
|
a = a*5
|
a* =5
|
a = a/6
|
a/ =6
|
a = a%10
|
a% 10
|
Here +=, -=, *=, /=, %= operators are called compound assignments operators.
Post a Comment