Chapter    10

Designing Your Own Data Structures

Chapter 8 introduced several new data types, such as float and char. We discussed the range of each type and the format specifiers used to print each type using printf(). Next, you explored the concept of arrays, focusing on the relationship between char arrays and C strings. Along the way, you discovered the #define statement, C’s text substitution mechanism. In Chapters 7, 8 and 9, you learned a lot about pointers.

This chapter will show you how to use existing C types as building blocks to design your own customized data structures. You’ll also learn how to dynamically allocate memory for those structures as you need it.

Bundling Data

There will be times when your programs will want to bundle ...

Get Learn C on the Mac: For OS X and iOS, Second 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.