next up previous contents index
Next: Declaring Arrays Up: Constants, Variables, and Arrays Previous: Variables


  An array is a group of memory locations given a single name. The elements of the array all have the same data type.

In mathematics the elements of an array a would be denoted by a1, a2, a3, and so on. In Fortran a particular array element is identified by providing a subscript expression in parentheses after the array name: A(1), A(2), A(3), etc. Subscripts must have integer type but they may be specified by expressions of arbitrary complexity, including function calls.

An array element can be used in the same way as a variable in almost all executable statements. Array elements are most often used within loops: typically an integer loop counter selects each element of the array in turn.

*Add array OLD to array NEW making array TOTAL 
      PARAMETER (NDATA = 1024) 
      DO 100, I = 1,NDATA 
          TOTAL(I) = OLD(I) + NEW(I) 


Helen Rowlands