answersLogoWhite

0


Want this question answered?

Be notified when an answer is posted

Add your answer:

Earn +20 pts
Q: What is the role of stack in calling a subroutine and returning from the subroutine?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is role of stack in calling a subroutine and returning from the routine?

The stack has many purposes, but is chiefly used to enable procedure calls. When you invoke a function, the return address (the next instruction after the function call) is pushed onto the stack. Control is then passed to the function. When the called function returns, it pops the return address off the stack and control is returned to that address. In this way functions can call functions without losing track of where the calls came from because return addresses are popped in the reverse order they were pushed. In other words, it provides an automatic "breadcrumb trail" without which it would be impossible to call and return from functions. The stack is also used to pass actual arguments to functions by pushing values onto the stack immediately after the return address. The called function can then pop those values off the stack and assign them to its formal arguments. Finally, the stack is used to store the function's local variables prior to calling a function. These are pushed onto the stack before the return address is pushed. In this way, a function can call itself recursively without losing track of its own local variables. Since invoking and returning from functions is a time-consuming operation, compilers will try to expand functions inline and thus eliminate the overhead of the function call. However, this needs to be weighed against the increased code size which can affect overall performance. By keeping functions small (one or two very simple statements), programs not only become much easier to read and maintain, there's also a much greater opportunity for inline expansion. Complex functions are never good examples for inline expansion.


What is the role of stacker in store?

The stacker's role is to stack objects and things that are in the store


Who is the next Jacob Black?

Taylor Lautner will be returning for his role as Jacob Black.


Which organisms play a role in returning carbon to the atmosphere?

Producers, consumers, and decomposers.


Was robert stack italian?

No, Robert Stack was not Italian. He was an American actor known for his role in the TV show "The Untouchables" and as the host of the show "Unsolved Mysteries." He was of Irish and German descent.


Who is the actor in The Movie The Return of Eliot Ness?

Robert Stack reprises his role from the 1959 TV series The Untouchables.


What is the role of the constructor?

Several meanings for "constructor". In object-oriented programming, it is the subroutine used to create an object. The programmer can add commands here, to get the object ready for his needs; for example, initialize the variables used in the object.


What role did Penelope play in the odyssey?

she was Odysseus's reason for returning home to Ithaca along with their son Telemachus


Is Lex Luthor returning on the TV show 'Smallville'?

Michael Rosenbaum is reprising his role for the series finale.


What is the role of microorganisms in returning nitrogen or carbon dioxide to the atmosphere?

this microorganisms is called denitrifying bacteria, it helps to decompose the nutrients (nitrogen) back to the atmosphere. and the process of returning nitrogen or carbon dioxide to the atmosphere is called denitrification.


Who is replacing eizabeth swann in pirates 5?

No one is returning in Pirates of the Caribbean 5 to play Elizabeth Swann. But, Orlando Bloom has recently expressed interest in returning in Pirates of the Caribbean 5, to play the role of William Turner.


What role does decay play in the nitrogen cycle?

The decomposers , bacteria, and fungi, break down waste and dead organisms returning nitrogen they contain back into the soil.