3.5. Arrays of Arrays.   

In many languages it is possible to have arrays of arrays of arrays etc and to deal with each variable type as

(1) elements of the array

(2) the array as a whole

(3) the array of arrays as a whole

(4) etc

The following example illustrates this:


 algorithm types

const linelength=132
pagelength=60
type string=array [1..linelength] of char
page= array [1..pagelength] of string
int= -Integer.MAX_VALUE .. Integer.MAX_VALUE
letter= 'A'..'Z'
digit= '0'..'9'
var
form,form2: page
line1,line2: string
count: array [letter] of integer
ch: char
i,j: integer
begin
form form2 // Copy entire array as a whole
for i 1 to pagelength do
form[i] form2[i] // Copy each line of array as a whole
for i 1 to pagelength do
for
j 1 to linelength do
form[i][j] form2[i][j] // Copy each character in each line of array
input(ch)
if ch in ['0'..'9'] then output('OK')
else output('nogo')
end.