Explanation of a recursion program through an image
Hello, if you can’t understand what happened in the stack by executing this code :
float _pow_recursion(float x, float y)
if (y == 0)
return (1); return (_pow_recursion(x, y - 1) * x);
Look at those images example for Y = 4 and x = 2, is it better?
Fill the stack to stop at base case
Clear the stack to get the result
The 2 in red at each step is the x value.
I know, it may not be easy to understand, contact me, if you need more explanation :D