5 Understanding Programming
5-60
CJ2 CPU Unit Software User’s Manual
Using Array Variables as Members of Data Structures
Arrays can be used as members of a data structure when there is a specific overall structure to the
data with members that each contains multiple elements in library fashion. Members can be freely
specified from the arrays. This is used when data is built from libraries.
Example: Communications frames can be created by selecting elements from libraries.
For detailed information on data structure specifications and creation procedures, refer to the CX-
Programmer Operation Manual: Function Blocks and Structured Text (Cat. No. W447).
A
0
1
2
B
0
1
2
Structure variable S
Member
A(1) of S
Array variable that
is a member of
the data structure
B(1) of S
A(x)
B(x)
C
0001Hex
0101Hex
0
1
2
0
1
2
Structure variable for communications frames
Member
Address(x)
Command(x)
Data
For communications frame address(1)
Array variable that
is a member of the
data structure
Addresses
0000 hex
0001 hex
000A hex
For communications frame command(1)
Commands
0001 hex
0101 hex
1002 hex