next up previous contents
Next: Array Attributes Up: Arrays Previous: Declaring Arrays   Contents

Memory Storage

Each element of A and B is a REAL number, and requires 4 bytes in the memory. The full A and B have 6 components, hence they require 24 bytes storage.

In F77 A it is stored in a contiguous 24-byte region in the memory as follows: A(1) in bytes 1 through 4, A(2) in bytes 5 through 8, , A(6) in bytes 20 through 24.

B is also stored in a contiguous 24-byte memory region, but now we have to be careful: the memory model is one-dimensional, while B is a two-dimensional array. F90 stores the first column of B first, the second column next and the third column last. In more detail, B(1,1) is stored in bytes 1 through 4, B(2,1) in bytes 5 through 8, B(1,2) in bytes 9 through 12, B(2,2) in bytes 13 through 16, B(1,3) in bytes 17 through 20 and B(2,3) in bytes 20 through 24.

We say in short that F77 uses storage association.

Unlike F77, F90 does not specify how arrays are to be organised in memory.

For input-output purposes an ordering of the elements is needed, and this is the colum-wise ordering (F77-similar). This ordering does not imply anything about the storage scheme. For example, if


the statement
print*, b
will produce the output


Similarly,
read*, b
will read in 6 numbers, the elements of B in column-wise order.


next up previous contents
Next: Array Attributes Up: Arrays Previous: Declaring Arrays   Contents
Adrian Sandu 2001-08-26