English
Language : 

CC78K4 Datasheet, PDF (129/523 Pages) NEC – CC78K4 Ver.2.30 or Later, C Compiler Language
CHAPTER 7 STRUCTURES AND UNIONS
(4) How to refer to structure members
A structure member (or structure element) may be referenced in two ways: one by using a structure variable and
the other by using a pointer to a variable.
[Reference by using a structure variable]
The . (dot) operator is used for referring to a structure member by using a structure variable.
struct data {
char name [12];
char addr [50];
char tel [12];
} no[5] = {“NAME”, “ADDR”, “TEL”}; *data_ptr = no;
void main(){
char c;
c = no[0]. name[1];
}
[Reference by using a pointer to a variable]
The −> (arrow) operator is used for referring to a structure member by using a pointer to a variable.
struct data {
char name [12];
char addr [50];
char tel [12];
} no[5] = {“NAME”, “ADDR”, “TEL”}, *data_ptr = no;
void main(){
char c;
data_ptr -> tel [3] = ‘E’ ;
}
User’s Manual U15556EJ1V0UM
129