English
Language : 

CC78K4 Datasheet, PDF (55/523 Pages) NEC – CC78K4 Ver.2.30 or Later, C Compiler Language
CHAPTER 3 DECLARATION OF TYPES AND STORAGE CLASSES
3.2.1 Structure specifier and union specifier
Both the structure specifier and union specifier indicate a collection of named members (objects). These member
objects can have different types from one another.
(1) Structure specifier
The structure specifier declares a collection of two or more different types of variables as one object. Each type
of object is called a member and can be given a name. For members, continuous areas are reserved in the
order of their declaration.
Align data is inserted by specifying the -RP option.
A structure is declared as follows. The declaration will not yet allocate memory since it does not have a list of
structure variables. For the definition of the structure variables, refer to CHAPTER 7 STRUCTURES AND
UNIONS.
struct identifier {member declaration list};
Example of structure declaration
struct tnode {
int count;
struct tnode *left, *right;
};
(2) Union specifier
The union specifier declares a collection of two or more different types of variables as one object. Each type of
object is called a member and can be given a name. The members of a union overlap each other in area,
namely, they share the same area.
A union is declared as follows. The declaration will not yet allocate memory since it does not have a list of union
variables. For the definition of the union variables, refer to CHAPTER 7 STRUCTURES AND UNIONS.
union identifier {member declaration list};
Example of union declaration
union u_tag {
int var1 ;
long var2 ;
};
Each member object can be any type other than the incomplete types or function types. A member can be
declared with the number of bits specified. A member with the number of bits specified is called a bit field.
In this compiler, extended functions related to bit field declaration have been added. For details, refer to 11.5
(19) Bit field declaration.
User’s Manual U15556EJ1V0UM
55