VMS Help
CC, Language topics, Data Types, Structure

 *Conan The Librarian (sorry for the slow response - running on an old VAX)

  A structure is an aggregate of members whose data types can differ.
  Members can be scalar variables, arrays, structures, unions, and
  pointers to any object.  The size of a structure is the sum of the
  sizes of its members, which are stored in the order of their
  declarations.  Structures are defined with the keyword struct,
  followed by an optional tag, followed by a structure-declaration
  list in braces.  The syntax is:

       struct [identifier] { struct-declaration ...  }

  Each struct-declaration is a type specifier (type keyword, struct
  tag, union tag, enum tag, or typedef name) followed by a list of
  member declarators:

       type-specifier member-declarator,...  ;

  Each member declarator defines either an ordinary variable or a bit
  field:

       declarator
  or
       [declarator] :  constant-expression

  The following example declares a new structure employee with two
  structure variables bob and susan of the structure type employee:

  struct employee {
     char *name;
     int   birthdate; /* name, birthdate, job_code, and salary are */
     int   job_code;  /* treated as though declared with const.    */
     float salary;
     };

  struct employee bob, susan;
  Close     HLB-list     TLB-list     Help  

[legal] [privacy] [GNU] [policy] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.