[Solved] Can anyone explain how this recursion code works exactly and what happens in the programs stack or in memory step by step? [closed]
It will be much easier to understand what is happening if you start with what happens closer to the base case of the recursion. Suppose you have fun(0) in your main. inside the body of fun this happens: void fun(int n) { if(n > 0) //this is false, so function does nothing { fun(n-1); printf(“%d … Read more