When function say abc() calls another function say xyz(), what happens in stack?

Questions by gopi_ra   answers by gopi_ra

Showing Answers 1 - 8 of 8 Answers

sandeep yadav

  • Mar 5th, 2006
 

when an fuction say abc() calls another function say xyz() then at the top of tha stack pointer to xyz() is there if it returns any value it will return to abc() and if abc() return any value it must return to its calling function............ 

  Was this answer useful?  Yes

Neeti

  • Mar 5th, 2006
 

When some function xyz() calls function abc(). all the local variables, static links, dynamic links and function return value goes on the top of all elements of function xyz() in the stack. when abc() exit it's return value has been assigned to xyz().

  Was this answer useful?  Yes

ritesh0101

  • Mar 8th, 2006
 

when a function calls another function then first of all the address of the next statement(next to the calling function) is stored in the stack memory using push and then the control of execution goes to the called function.

  Was this answer useful?  Yes

Minakshi Mittal

  • Apr 27th, 2006
 

Hi, I am Minakshi here. I read your solution of following problem "when function say abc() calls another function say xyz(), what happens in stack?" I am satisfied with this . If you don't mind may I know what are you doing at present . I have some problem in "filehandling" and "Structure and union" . Can you help me in this topics . ByeMeenakshi

  Was this answer useful?  Yes

Sunil Soni

  • May 5th, 2006
 

when the function 'abc()' calls another function 'xyz()' then first of all, current status of execution is stored in the STACK i.e. the address of current statement (Which lies in Code segment), then all the parameters passed during the call of 'xyz()' (If any) are stored in the STACK then only actual function starts executing. When the function execution completes and control comes at return, then all parameters are popped from the stack followed by the address code and control returns to the current statement.

  Was this answer useful?  Yes

jintojos

  • Jul 7th, 2008
 

before the control transfered into the called fucntion(ie. xyz()), the values in some of the registers copied into the stack(registers are : BP,SP,CS,IP,falg).also the values of the local variables are stored into stack and then the control is transfered into the called function xyz(); and before returning from the function xyz() all pushed datas are poped into respective registers and variables.Then the control is transfered into the calling function abc();   

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions