c/language/operator assignment

Assignment and compound assignment operators are binary operators that modify the variable to their left using the value to their right.

Simple assignment
The simple assignment operator expressions have the form

where

Assignment performs from the value of  to the type of  and then replaces the value in the object designated by  with the converted value of.

Assignment also returns the same value as what was stored in (so that expressions such as  are possible). The of the assignment operator is non-lvalue (so that expressions such as  are invalid).

and must satisfy one of the following:
 * both and  have   or  type, or..
 * must be to, which implies
 * both and  have, in which case  may be -qualified
 * both and  have  to  (ignoring qualifiers) types, or one of the pointers is a pointer to void, and the  would not add qualifiers to the pointed-to type.  may be -qualified.
 * is a (possibly qualified) pointer and is a null pointer constant such as null

Compound assignment
The compound assignment operator expressions have the form

where

The expression   is exactly the same as      , except that  is evaluated only once.