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 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.