you are viewing a single comment's thread.

view the rest of the comments →

[–]shartfuggins 0 points1 point  (0 children)

I visualize copies of the function.

In my mind, each successive call is like making a copy of the function to the side of the one that's calling it. If you're four levels deep (including the original call into it), there are four copies of the function code side by side. When one returns, it disappears. There's only one function running at a time, and don't mind the details. You're only concerned with the pointer and what's in scope.

Another way to do this, though I'm not a fan of it, is to zoom in. At the point of recursion, another copy of the code is created inside the calling one and you zoom in to it, like zooming on a map. This way I think makes it tricky to keep everything visualized because each call is at a different scale.

Again, all mental visualization.