2. Embedded QUEL for C : C Variables and Data Types : Variable and Type Declarations : A Structure with a Body and No Tag
 
Share this page                  
A Structure with a Body and No Tag
The syntax of a C structure declaration with a body and no tag is:
struct {
             structure_declaration {structure_declaration}
} structure_variable_name;
where structure_declaration is the same as in the previous section.
In the context of a simple variable declaration, the structure's syntax is:
struct {
      
structure_declaration {structure_declaration}
structure_variable_name;
In the context of a type declaration, the structure's syntax is:
typedef struct {
              structure_declaration {structure_declaration}
} structure_type_name;
Syntax Notes:
All common clauses have the same rules as in the previous section. For example, struct and union are treated as equivalent, and the same rules apply to each structure member as to variables of the same type.
Specify the structure_variable_name when there is no tag. In fact, the actual structure definition applies only to the variable being declared.
The following example illustrates the use of a body with no tag:
##  define MAX_EMPLOYEES 1500
##  struct
##  {
##       char      name[21];
##       short     age;
##       double    salary;
##  } employees[MAX_EMPLOYEES];