40 votes 40 votes In the C language: At most one activation record exists between the current activation record and the activation record for the main The number of activation records between the current activation record and the activation records from the main depends on the actual function calling sequence. The visibility of global variables depends on the actual function calling sequence Recursion requires the activation record for the recursive function to be saved in a different stack before the recursive function can be called. Programming in C gatecse-2002 programming programming-in-c easy descriptive + – Kathleen asked Sep 15, 2014 • edited Jun 15, 2018 by Milicevic3306 Kathleen 10.2k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 94 votes 94 votes Each function call starts a new activation record and since C allows nested function calls more than one activation record can exist between the current activation record and main. TRUE Since, C uses static scoping, the actual function calling sequence has no impact on the visibility of global variables. If a variable is not found in the current activation record, it is looked in global address space and this is independent of the calling sequence. All function calls- whether recursive or not uses the same stack for saving the activation record. There is no need for a different stack as for C compiler a recursive function call and a normal function call make no difference. Arjun answered Dec 1, 2014 • edited Aug 4, 2018 by Manoja Rajalakshmi A Arjun comment Share Follow See all 7 Comments See all 7 7 Comments reply Wanted commented Jan 12, 2017 reply Follow Share @arjun sir thse things are little contradictory explain it more Each function call starts a new activation record and since C allows nested function calls more than once activation record can exist between the current activation record and main. All function calls- whether recursive or not uses the same stack for saving the activation record. There is no need for a different stack as for C compiler a recursive function call and a normal function call make no difference. 2 votes 2 votes srestha commented Oct 27, 2017 reply Follow Share Do activation record and stack same? 0 votes 0 votes Puja Mishra commented Dec 8, 2017 reply Follow Share @srestha Activation Record A data structure containing the important state information for a particular instance of a function call (or something that resembles a function call). May exist entirely in memory, or be partially stored in registers. Typically, an ActivationRecord contains the following: A pointer to the ActivationRecord of the caller (commonly known as the DynamicChain), though in a language with ContinuationPassingStyle even this isn't necessary (when the function returns, it does so via the supplied continuation; rather than the DynamicChain). In languages which allow nested LexicalScoping, a pointer to the ActivationRecord of the enclosing scope (aka the ReferencingEnvironment) - this pointer is called the StaticChain. In most such languages, it is generally a requirement that somewhere up the call chain, the enclosing function have been called (but in concurrent languages it may have been called in a different thread). In languages like C/C++ where nested LexicalScopes are disallowed (or restricted), a StaticChain is unnecessary. Java InnerClasses also seem to be designed in order to avoid aStaticChain. Local variables (frequently cached in registers) Actual parameters to the function (also frequently cached in registers) Space for the (eventual) return value of the function. 12 votes 12 votes talha hashim commented Aug 21, 2018 reply Follow Share nice explanation @arjun sir 1 votes 1 votes talha hashim commented Aug 21, 2018 reply Follow Share puja mam u r great, always provide important informations 0 votes 0 votes samarpita commented Jun 25, 2022 reply Follow Share @Arjun @Sachin Mittal 1 @Shaik Masthan sir in C “since C allows nested function calls” but sir C doesn’t allow nested function calls “We cannot define a function within another function in standard C.We can declare a function inside of a function, but it's not a nested function.”https://stackoverflow.com/questions/2608158/nested-function-in-c here it is told.We can see option A like this,C(){}B(){ C();}A(){ B();}main(){ A();}So if the current activation record in the stack is C(). So between the activation record of C() and main() ...there is activation record of A() and B().@shishir__roy plz see this 1 votes 1 votes shishir__roy commented Jun 25, 2022 reply Follow Share @samarpita we're taking about nested function calls and not nested function definitions. nested function call means calling one function from another function. Your counter example to option A seems correct to me. 1 votes 1 votes Please log in or register to add a comment.