Chapter 20
Memory Chunks and Linked Lists
IN THIS CHAPTER
Grabbing a chunk of memory with malloc()
Initializing and allocating memory
Resizing an allocated memory chunk
De-allocating memory
Creating space for a structure
Building a linked list
Editing structures in a linked list
Another reason for having a pointer variable is to hold the address of a freshly allocated chunk of memory. This approach is far better than creating an array and guessing at its size: Memory chunks can be assigned a size on the fly, resized, and banished. You can’t perform such actions with an array — well, not in civilized society.
Dovetailing from memory allocation comes the ultimate thrill ride in the C language amusement park: the linked list. It combines the mystery of structures with the dread of pointers ...
Get C Programming For Dummies, 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.