In general computer science, a side effect of a routine is any change to data that is not in that routine's immediate scope.

For example, the routine "bar" in the following Pascal code has a side effect:

procedure foo;

var i: integer;

procedure bar (j: integer);

begin
i := i + j; { side effect }
end;

begin
i := 0;
bar (3);
writeln (i); { also a side effect }
end;


The C++ Standard defines a side effect as "changes in the state of the execution environment", specifically,

(1.9.7) Accessing an object designated by a volatile lvalue, modifying an object, calling a library I/O function, or calling a function that does any of the above.."