27. Setting Up Your Data with Structures

Arrays and pointers are nice for lists of values, but those values must all be of the same data type. Sometimes you have different data types that must go together and be treated as a whole.

A perfect example is a customer record. For each customer, you have to track a name (character array), balance (double floating-point), address (character array), city (character array), state (character array), and zip code (character array or long integer). Although you would want to be able to initialize and print individual items within the customer record, you would also want to access the customer record as a whole, such as when you ...

Get C Programming Absolute Beginner’s Guide, Third Edition now with O’Reilly online learning.

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