In ISO C11 (and some extensions of ISO C++) an anonymous struct is a data member of struct type, whose members are treated as members of the enclosing struct or union. It is declared as `struct { /* members */ };`.
In C starting with the 2011 ISO standard (and some extensions of ISO C++) an anonymous struct is a data member of struct type, whose members are treated as members of the enclosing struct or union. It is declared as struct { /* members */ };.
Anonymous structs should not be confused with unnamed structs (which are an official C++ feature). That is a struct that has simply been given no name, such as in the following case:
// The type of "lineInfo" is an *unnamed struct*, 
// but "lineInfo" is _not_ an *anonymous struct*
struct {
   int lineNumber;
   int length;
} lineInfo;
In the following, the struct that contains byte0 and byte1 is anonymous, and those two members become members of the enclosing union, so that things.byte0 becomes valid:
union {
  struct {
    char byte0;
    char byte1;
  };
  char bytes[2];
} things;
 
     
     
     
     
     
     
     
     
     
     
     
    