Stack
Chris,
A stack is used to store return addresses, so that when one routine
calls another, when that 2nd routine is done…the program knows where to
return to so it can continue. The stack is also used to pass values from
one routine to another. So that if routine1 needs to send a value to
routine2, it simply puts it on the stack. routine2 has been created so
that it knows to read that value off of the stack.
A stack is also used to create what are known as 'local variables',
that is…variables that are created and used within a single routine.
That's a very simplistic explanation, but there's not room here to
give a full and complete description of stack usage with examples. However,
hopefully it gives you a bit of a better idea of how it's used and why.
Don