I\'ve heard that any recursive algorithm can always be expressed by using a stack. Recently, I\'ve been working on programs in an environment with a prohibitively small avai
Your particular example is tail-recursive, so with a properly optimising compiler, it should not consume any stack depth at all, as it is equivalent to a simple loop. To be clear: this example does not require a stack at all.