#include #include using namespace std; int f(int x) { return ++x;} int g(int& x) { return ++x;} int main() { int x = 2; /* f is "functional", as it has no side-effects */ f(x); assert(x==2); /* g changes a variable of an outer scope, * i.e. it has a side effect * Thus, g is not functional! */ g(x); assert(x!=2); }