A stack is a data structure with the following two operations:
|
Suppose the stack is:
Stack: Stack Top ---> +----------+ | 9 | +----------+ | 4 | +----------+ |
After a push(1) operation, the stack is:
Stack:
Stack Top ---> +----------+
| 1 |
+----------+
| 9 |
+----------+
| 4 |
+----------+
|
Suppose the stack is:
Stack: Stack Top ---> +----------+ | 9 | +----------+ | 4 | +----------+ |
After a pop( ) operation, the stack is:
Stack: Stack Top ---> +----------+ | 4 | +----------+ |
The pop( ) operation will return the value 9
Initial state when
a program
starts
running:
|
Some of the available memory is used maintains a program runtime stack to store runtime information:
|
The runtime stack is stored at the end of the memory:
The top of the stack is stored/recorded in the Stack Pointer Register SP:
How do you find the program (runtime) stack in EGTAPI:
|
Example: