2. Embedded QUEL for C : C Variables and Data Types : Variable and Type Declarations : A Structure with a Tag and No Body
 
Share this page                  
A Structure with a Tag and No Body
The syntax of a C structure declaration with a tag and no body is:
struct tag_name
In the context of a simple variable declaration, the syntax is:
struct tag_name structure_variable_name;
In the context of a type declaration, the syntax is:
typedef struct tag_name 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 structure can be initialized without the preprocessor checking for a structure aggregate.
The tag_name must refer to a previously defined structure or union. The preprocessor does not support forward structure declarations. Therefore, when referencing a structure tag in this type of declaration, the tag must have already been defined. In the declaration below, the tag "new_struct" must have been previously declared:
## typedef struct new_struct *NEW_TYPE;
The following example illustrates the use of a tag and no body:
  ## union a_name
  ## {
  ##     char        nm_full[30];
  ##     struct 
  ##     {
  ##     char nm_first[10];
  ##     char nm_mid[2];
  ##     char nm_last[18];
  ##     } nm_parts;
  ## };

## union a_name empnames[MAX_EMPLOYEES];