Section 6
Heaps vs. Stack
Let’s say we are using C. Would you use the stack or the heap, and why?
Stack
Heap
If you were writing a compiler, would you use the stack or the heap, and why?
What if we want 64 bit tagged floats or ints?
Pick any kind of data from any programming language. Look up whether it’s stored on the stack or the heap and why!
Example: Java objects are stored on the (stack/heap) because …