We all learned about mathematical functions when we studied algebra: *y = f(x), where f(x) = ax ^{2}+….* In the abstract world of mathematics, functions are pure and reproducible and have no side effects.

In imperative programming languages such as C, functions (in the sense of subroutines that return a value) are often anything but pure, since they rely on internal and external state, and they may change their behavior from one invocation to another. While it's often useful and expedient to have functions with side effects, they can be complicated to debug and may present a nightmare for a maintainer.