Head First C Pages 5
Head First C Pages 5
6
Building bridges
Sometimes, a single struct is simply not enough.
To model complex data requirements, you often need to link structs together. In
this chapter, you’ll see how to use struct pointers to connect custom data types into
large, complex data structures. You’ll explore key principles by creating linked lists.
You’ll also see how to make your data structures cope with flexible amounts of data by
dynamically allocating memory on the heap, and freeing it up when you’re done. And
if good housekeeping becomes tricky, you’ll also learn how valgrind can help.
32 bytes of
Craggy
data at location
4,204,853 on the
heap
Shutter
Isla Nublar
xvii
www.it-ebooks.info