2.2. Reading an array.   

In reading data into an array we must systematically access each of the elements of the array. And we must specify them in the order in which the data items themselves are organised. This will be in columns and, as well, usually in rows. Therefore in english:


for each row i do
input
all the values in row i

To read in all the values in row i we must consider each of the column positions in the row. Therefore

for each row i do /* read the array A */
for each column j do
input
a[i,j]

More formally, in pseudo code, we would have:

for i 1 to n do
for
j 1 to n do
input
a[i,j]
endfor
endfor

or using better variable names:

for row 1 to n do
for
column 1 to n do
input
a[row,column]
endfor
endfor