3.11 STRUCTURES
Business data processing was the prime computing activity for last 30 years. Data were typically in the form of records. A record consists of one or more variables (representing data items). Records are called structures in C++. A structure is essentially a collection of variables to represent specific data (or an entity).
Let us take a familiar example of date. It has three components viz. day, month and year. In a C++ program, we can define a structure “Date” as shown below.
struct Date { int day int month; int year; } ;
The definition starts with keyword struct. The word Date appearing after keyword struct is known as “structure tag”.
Now this tag “Date” represents a type. We can define variables of this type ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access