Answers to questions on automatic variables

  1. Why is it desirable to use distinctly named automatic variables?
    It is easy to confuse automatics used inside a function or compound statement block with the same named variables used outside that function or block. If the declaration made locally is changed, the global definition may mask the fact that the name is being used by mistake.

  2. What happens to automatic variables in recursive function calls?
    A new copy, with its value initially undefined, is made for each new call.

Back to the questions.


Back to notes on automatic variables.