[prev] 80 [next]

Structures

A structure
  • is a collection of variables, perhaps of different types, grouped together under a single name
  • helps to organise complicated data into manageable entities
  • exposes the connection between data within an entity
  • is defined using the struct keyword
Example:

struct date {
       int day;
       int month;
       int year;
}; // don't forget the semicolon!