6DYNAMICALLY ALLOCATED MEMORY
In Chapter 2, you learned that every object has a storage duration that determines its lifetime, and that C defines four storage durations: static, thread, automatic, and allocated. In this chapter, you’ll learn about dynamically allocated memory, which is allocated from the heap at runtime. Dynamically allocated memory is useful when the exact storage requirements for a program are unknown before runtime.
We’ll first describe the differences between allocated, static, and automatic storage duration. We’ll skip thread storage allocation as this involves parallel execution, which we don’t cover here. We’ll then explore ...
Get Effective C 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.