April 2021
Intermediate to advanced
539 pages
10h 44m
English
So far, we have managed to write programs that only use global and local variables. In C-speak, these are called static and automatic memory allocation, and static memory allocation lasts the lifetime of the program. In contrast, automatic variables are deleted when you return from the function you defined them in. In practice, automatic means stack allocated, although the C standard doesn’t require there to be a stack. The third type of memory is dynamic memory, which is the memory you allocate on the heap in the idealized memory model we saw in Chapter 2. This is the memory you ...
Read now
Unlock full access