< previous page page_780 next page >

Page 780
allows you not only to declare a struct type but also to declare variables of that type, all in one statement. For example, you could write the declarations
struct StudentRec
{
    NameString firstName;
    NameString lastName;
     .
     .
     .
};

StudentRec firstStudent;
StudentRec student;
more compactly in the form
struct StudentRec
{
    NameString firstName;
    NameString lastName;
     .
     .
     .
} firstStudent, student;
In this book, we avoid combining variable declarations with type declarations, preferring to keep the two notions separate.
If you omit the type name but include the variable list, you create an anonymous type:
struct
{
    int  firstMember;
    float secondMember;
} someVar;
Here, someVar is a variable of an anonymous type. No other variables of that type can be declared because the type has no name. Therefore, someVar cannot participate in aggregate operations such as assignment or parameter passage. All the arguments given in Chapter 10 against anonymous typing of enumeration types apply to struct types as well.

 
< previous page page_780 next page >