A Quick Review of Structs

In C and other languages a structure (ie struct) is used to group pieces of related data of different types into a single entity. For example, a DayOfYear might be made up of two integers representing the month and day. struct DayOfYear { int month; /* 1 = Jan ... 12 = Dec */ int day; }; The identifiers inside the brackets ( month, day ) are called member names or simply members.

When a structure variable is declared, the value of each member can be accessed using the dot notation as seen below

DayOfYear july4th; july4th.month = 7; july4th.day = 4;

Last Modified: Monday, 28-Aug-2006 10:15:53 EDT