C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
Anonymous Structures
                                             Up Contents Index Back
─────C/C++ Language─────────────────────────────────────────────────────────
 
     A Microsoft C extension allows you to declare a structure variable
     within another structure without giving it a name. These nested
     structures are called anonymous structures. C++ does not allow
     anonymous structures.
 
     You can access the members of an anonymous structure as if they
     were members in the containing structure. For example:
 
          struct phone
          {
             int  areacode;
             long number;
          };
 
          struct person
          {
             char   name[30];
             char   sex;
             int    age;
             int    weight;
             struct phone;    // Anonymous structure; no name needed
          } Jim;
 
          Jim.number = 1234567;
                                    -♦-