42
42
* [ What is "stack overflow"?] ( #q500 )
43
43
* [ What is "stack underflow"?] ( #q600 )
44
44
* [ On the LS-8, why does the stack pointer start at address ` F4 ` , when the first stack element is at ` F3 ` ?] ( #q700 )
45
- * [ How are stacks and subroutines used by higher-level languages like C ?] ( #q800 )
45
+ * [ How are stacks and subroutines used by higher-level languages like Python ?] ( #q800 )
46
46
* [ Why does the CPU allow for stack overflow or underflow?] ( #q2900 )
47
47
* [ Why does the CPU support a stack and not some other data structure?] ( #q3000 )
48
48
* [ On the LS-8, why does ` POP ` need an operand?] ( #q3500 )
@@ -172,10 +172,10 @@ stored there. Exactly where we wanted it.
172
172
------------------------------------------------------------------------
173
173
174
174
<a name =" q800 " ></a >
175
- ### How are stacks and subroutines used by higher-level languages like C ?
175
+ ### How are stacks and subroutines used by higher-level languages like Python ?
176
176
177
- In C , when you make a function call, a bunch of space is allocated (pushed) on
178
- the stack to hold a number of things:
177
+ In Python , when you make a function call, a bunch of space is allocated
178
+ (pushed) on the stack to hold a number of things:
179
179
180
180
* The return address to come back to after the function completes
181
181
* Space for all the function parameters
@@ -184,7 +184,7 @@ the stack to hold a number of things:
184
184
This allocated chunk of stack is called a [ stack
185
185
frame] ( https://en.wikipedia.org/wiki/Call_stack#STACK-FRAME ) .
186
186
187
- When you call any function (including when ` main() ` gets called in C) :
187
+ When you call any function:
188
188
189
189
1 . A new stack frame is allocated (pushed)
190
190
2 . Parameter values are copied from the function arguments to their spots on the
@@ -853,4 +853,4 @@ from RAM.
853
853
854
854
> Capacities and speeds are examples only. Actual number vary.
855
855
856
- ------------------------------------------------------------------------
856
+ ------------------------------------------------------------------------
0 commit comments