Side Effects


In common English usage, a side effect is something which is of secondary importance or incidental significance; in C terminology the concept is rather different. For example, in a simple assignment statement such as "x = 1;", the modification of the value of x is clearly the primary intent of the statement but is described as a side effect. The actions which are deemed to cause side effects are as follows:

A statement such as "x = 2 * y++;" has two side effects, the assignment of a new value to x and the incrementing of y. Care must be taken in writing any statement which involves multiple side effects because the order in which side effects occur within a C statement is usually not specified.

See also:

Order of Evaluation
Sequence Point
Index