1.

If an automatic variable is created and then a function is called then ________________(a) The automatic variable created gets destroyed(b) The automatic variable doesn’t get destroyed(c) The automatic variable may or may not get destroyed(d) The automatic variable can’t be used in this caseI got this question in my homework.My doubt stems from Automatic Variable in division Memory Allocation & Scope of Variable of Object Oriented Programming

Answer» RIGHT choice is (b) The AUTOMATIC variable doesn’t get destroyed

To explain: The automatic VARIABLES are saved till the called FUNCTION gets executed. This is done so as to ensure that the program can continue its execution after the called function is returned. The automatic variables gets destroyed only if those go out of scope.


Discussion

No Comment Found

Related InterviewSolutions