A side-effect is an effect that happens during evaluation of an expression, other than just computing the value of the expression. For example, evaluation of expression ++x in C++ has the side effect of changing the value of variable x.

In a language that allows expressions to have side effects it is possible to evaluate the same expression twice and to get different answers. For example, suppose that function f is defined in C++ by

     int f(int& z) {return ++z;}
Then
    int z = 20;
    const int x = f(z) + f(z);
does not produce the same value for x as
    int z = 20;
    const int y = f(z);
    const int x = y + y;
The two occurrences of f(z) do not produce the same answer.