FAQs on the exercise Call Stacks and Execution Frames
There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
Agree with a comment or answer? Like () to up-vote the contribution!
When a recursive function enters the base case without any recursive calls, will the call stack be empty? Why or why not?
I just want to get it right. So, the answer to this question is NO, because we entered teh base case but the recursive call didn’t happen (for some reason?), meaning we didn’t perform an action with the base case…?
I have the same doubt too. I guess the call stack would never be called because our recursive function would already have returned a value from the base case. So, there’s no purpose for the computer to keep track of the argument and the function invocations.
When a recursive function enters the base case without any recursive calls, will the call stack be empty?
Why or why not?
An interpreter would surely add every function call to the call stack? If there is no recursive element, then the call stack has a size of 1 so is effectively a call node, but it’s still there keeping track of where we are in the flow of the program.