Question: what is the difference between pure and impure function?
Answer: A pure function may not change the variable it's passed. An impure function does, so for example if you pass the variable x to the function int addOne(x);, add one could return x + 1, and not change x(pure), or addOne(x); could increment x by one, so the value of the variable x is now changed.