Print

Print


On Mon, Sep 26, 2011 at 12:42 PM, Garth Wallace <[log in to unmask]> wrote:
> The topmost element in
> turn contains the address of the element below it, that element
> contains the address of the element below it, and so on.

What you describe is a data structure called a "linked list". A stack
(normally) resides in consecutive memory locations so it is not
necessary for each entry to include the address of the next entry.
That would be redundant. The linked list allows sequential entries to
be in non-adjacent memory locations. The stack is based on a single
pointer called the "stack pointer" which normally points to the first
unused memory location past the top of the stack so that "push"
consists of "store then increment", and "pop" consists of "decrement
then retrieve".

--gary