0% found this document useful (0 votes)
6 views4 pages

Call Stacks

Call stacks store information about the active functions in memory. When a function is called, a new stack frame is pushed onto the top of the call stack and becomes the active frame. When the function finishes, its frame is popped off the stack and the next frame below becomes active.

Uploaded by

Fin Bourke
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views4 pages

Call Stacks

Call stacks store information about the active functions in memory. When a function is called, a new stack frame is pushed onto the top of the call stack and becomes the active frame. When the function finishes, its frame is popped off the stack and the next frame below becomes active.

Uploaded by

Fin Bourke
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Call Stacks

Wednesday, 15 November 2023 19:36

When you call a function, the system sets aside space in memory for that
function to do its work

- We call such chunks of memory stack frames

- More than one function's stack frame may exist in memory at a given time.
- If main() calls move(), which then calls direction() all three functions have
open frames
- These frames are arranged in a stack. The frame for the most recently
called function is always on the top of the stack

CALL STACK
- When a new function is called, a new frame is pushed onto the top of a
stack and becomes the active frame

- When a function finishes its work or returns, its frame is popped off the
stack
- the frame below it becomes the new active function on the top of the
stack,
- This function picks up where it left off

In recursio
stack and
in which t
onto the n
on each function is piled onto the
d on hold until the base case is reached,
they leave the stack passing the value
next.

You might also like