Skip to main content
4 events
when toggle format what by license comment
Feb 3, 2017 at 17:12 comment added Blauelf Each time you call a function, you create a new context on the stack, with local variables and stuff. When you leave the function, the stack pointer is reset and that memory is available again. Since you call the next function without leaving the current, you run out of stack memory after a few calls (might be in the range of a few thousand, depending on number of variables on stack). Since the return value is simply passed from the calling function (the recursive call is the very last thing that the function does), the compiler might change that into a loop.
Feb 3, 2017 at 16:17 comment added J Doe CS50 And one more question, what exactly in this kind of algo makes me run out of call stack? Number of times function is called?
Feb 3, 2017 at 16:06 comment added J Doe CS50 Thanks for catching this error, however it looks like compiler somehow corrected it.
Feb 3, 2017 at 14:33 history answered Blauelf CC BY-SA 3.0