24.11.2014 Views

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

Open Watcom FORTRAN 77 Language Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Language</strong> <strong>Reference</strong><br />

[lo:] hi<br />

where:<br />

lo<br />

hi<br />

is the lower dimension bound.<br />

is the upper dimension bound.<br />

The lower and upper dimension bounds must be integer expressions and the upper dimension bound must<br />

be greater than or equal to the lower dimension bound. The upper dimension bound of the last dimension<br />

may be an asterisk (*). The meaning of this will be discussed later. If the lower dimension bound is not<br />

specified then a default of 1 is assumed. The size of a dimension is defined as hi − lo + 1. Note that if<br />

the lower dimension bound is not specified the size of the dimension is just hi. The size of the array (or<br />

the number of elements in the array) is defined as the product of all the sizes of the dimensions of the array.<br />

The maximum number of elements in any dimension is limited to 65535. The maximum size of an array is<br />

limited by the amount of available memory.<br />

Arrays are defined by the appearance of an array declarator in a DIMENSION statement, a type statement<br />

or a COMMON statement.<br />

Example:<br />

DIMENSION A(10), B(-5:5,-10:10)<br />

INTEGER C(10,20)<br />

COMMON /DATA/ X,Y(30,30),Z<br />

In the previous example, B is a 2-dimensional array with 11 rows and 21 columns and has 231 elements<br />

(i.e. 11 * 21).<br />

Each array has a data type associated with it. This data type is inherited by all elements of the array.<br />

4.3 Array Elements<br />

Each array is comprised of a sequence of array elements. An array element is referenced by following the<br />

array name with a subscript. Different elements of the array are referenced by simply changing the<br />

subscript. An array element has the following form:<br />

<br />

a(s[,s]...)<br />

where:<br />

a<br />

(s[,s]...)<br />

s<br />

is the array name.<br />

is a subscript.<br />

is a subscript expression.<br />

160 Array Elements

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!