I\'m having a hard time understanding why
#include using namespace std; int fib(int x) { if (x == 1) { return 1; } else {
When x==2 you call fib(1) and fib(0):
x==2
fib(1)
fib(0)
return fib(2-1)+fib(2-2);
Consider what will happen when fib(0) is evaluated...