In the last section, we considered multiples in structures. What happens if we have a multiple each of whose elements is a structure? No problem. If we had declared
[10]COMPL z4
then the selection re OF z4
would yield a name with
mode REF[]REAL
and bounds
[1:10]
.8.1 It
would be possible, because it is a name, to assign to it:
re OF z4:=(1,2,3,4,5,6,7,8,9,10)
Selecting the field of a sliced multiple of a structure is
straightforward. Since the multiple is sliced before the field is
selected, no parentheses are necessary. Thus the real part of the
third COMPL
of z4
above is given by the
expression
re OF z4[3]
Now consider a multiple of a structure which contains a multiple. Here is its declaration:
[100]STRUCT(CHAR c,[5]INT i)s
Then the fourth integer in the 25th structure of
s
is given by
(i OF s[25])[4]
and all the characters are given by the selection
c OF s
with mode REF[]CHAR
and bounds
[1:100]
.8.2
[20]EMPLOYEE employee;What would be the mode of each of the following: Ans
(dept OF employee[3])[3]
dept OF employee[10:12]
ni code OF employee[1]
net pay OF employee[15]
(tax OF employee[2])[50:51]
Sian Mountbatten 2012-01-19