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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.