The Stack

The Stack is the fundamental underpinning of how memory works. It is complicated but you must understand it to move forward. We are going to watch a few videos until it makes sense. I will make my own someday.

This explains the stack as a data structure: https://www.youtube.com/watch?v=CgFVgp_VCN8

This explains stack for memory: https://www.youtube.com/watch?v=IWQ74f2ot7E

And this finally explains what the hell it all means in regards to how programs work: https://www.youtube.com/watch?v=Q2sFmqvpBe0&t=318s

Function call basics:

Important Stack Notes:

  • Conceptual, does not exist as a clearly defined place
  • Last in, first off data structure (LIFO)
  • Push on, pop off
  • Stack grows from higher to lower memory addresses
    • Saying the stack grows up or down does not specify towards high or low addresses and can be confusing
    • In this course, stack grows DOWN towards LOWER memory addresses.

Task:

  • Submit text discussing anything that you struggled with and didn't understand, and what you did to overcome that problem. If you still don't understand, tell us what specifically you did not understand.