posted 14 years ago
Hi, my first post here.
I've been trying to wrap my mind around memory allocation for recursive functions.
As far as my understanding goes a recursive function has to go all the way down in the recursion chain until a definite value is returned and consecutive results bubble up. Every recursion step towards that definite return value requires some memory allocation which can lead to stack overflow (like in the example below).
In a book, i came across an example which supposedly solves the stack overflow problem but i cant see how. Is memory still allocated in same fashion as in example above?
Regards
Igor