English
Language : 

CC78K0S Datasheet, PDF (60/520 Pages) NEC – C Compiler Ver.1.30 or Later Language
CHAPTER 3 DECLARATION OF TYPES AND STORAGE CLASSES
3.2.3 Tags
A tag is a name given to a structure, union, or enumeration type. A tag has a declared data type and objects of
the same type can be declared with a tag.
The identifier in the following declaration is a tag name.
structure/union
identifier {member declaration list}
or
enum identifier {enumerator list}
A tag contains the contents of the structure/union or enumeration defined by a member. In the next and
subsequent declarations, the structure of a struct, union, or enum type becomes the same as that of the tag’s list. In
the subsequent declarations within the same scope, the list enclosed in braces must be omitted. The following type
specifier is undefined with respect to its contents and thus the structure or union has an incomplete type.
structure/union
identifier
A tag to specify the type of this type specifier can be used only when the object size is unnecessary. The reason
is that by defining the contents of the tag within the same scope, the type specification becomes incomplete.
In the following example, the tag “tnode” specifies a structure that includes pointers to an integer and two objects
of the same type.
struct tnode{
int count;
struct tnode *left,*right;
};
The next example declares “s” as an object of the type indicated by the tag (tnode) and “sp” as a pointer to the
object of the type indicated by the tag. By this declaration, the expression “sp → left” indicates a pointer to “struct
tnode” on the left of the object pointed to by “sp” and the expression “s.right → count” indicates “count” which is a
member of “struct tnode” on the right of “s”.
typedef struct tnode TNODE;
struct tnode{
int count;
struct tnode *left,*right;
};
TNODE s *sp;
void main(void){
sp->left=sp->right;
s.right->count=2;
}
60
User’s Manual U14872EJ1V0UM