Chapter 7Heap Memory
Chapter 2 describes one type of memory: stack memory (also called the call stack). Stack memory follows a simple rule: first in, last out. The call stack is managed by the code generated by the compiler. Every time a function is called, a new frame is pushed. Every time a function ends, the frame is popped. Programmers have no direct control over this process. One consequence is that a function may read from or write to memory addresses in lower frames; however, a function can never “look upward” into memory above its frame. This is because whenever a function is actively executing, there are no valid memory addresses “above” the current function's frame. Sometimes programmers need more control ...
Get Intermediate C Programming, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.