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

Subscripting

real, dimension(6)   :: A
real, dimension(2,3) :: B, C
B = C

One can select elements of an array using subscripts. For example, A(2) and B(2,2) are REAL variables, denoting and respectively. The array subscripts must be integer numbers, integer variables, or expressions returning an integer result.

The statement

A(2) = 0.0
B(2,2) = 1.0
sets sets to 0 and to the value 1.

We can reference the whole array by its name. For example, the statement

B = 1.0
will set all the elements in B to 1.

We can select array sections using the ``:'' selector. For example, we can set to 0 and to 1 using

A(1:3) = 0.0
B(1:2,1:2) = 1.0



Adrian Sandu 2001-08-26