Department of Engineering

IT Services


Structures are used to construct variables with multiple components of possibly differing types. Each component (also known as a data member or field) is referenced by a name rather than by an index expression as in arrays. A '.' is used to indicate data member access. Examples of definition and use:

struct Complex {
   float    re;
   float    im;

struct Time {
   int      hour;
   int      min;

Complex     a,b;
Time        t; = +;        // a = a + b = +;
t.hour = 12; t.min = 0;    // t = noon;