
FORTRAN Concepts |
The possibleJorms of aninteger constant are:
[s]d" .
or
[sl#d ...b
where:
sis an optional + or
dis a digitor.one of the letters A~F
bdesignates the number base and is one of the letters D,B,O; Q, or H
lfthe numher base specjfier is absent or is the letter >'D/thecharacler string 'd ... '
can contain only the digitsO~9artdjsinterpretedas a decimal number.. If the base
specifier '8' is present, the character stringmust contain only the digits oand 1 and is interpreted asa binary number. leo' or 'Q' is specified as thebase, the numper can·contain only the digits·
The following are valid integer constants:
o
23
+64101
-#14010
#100010108
-#4567Q +#AF2CH
2.2.3 Arrays
Frequently, the programmer will want to refer to a group of data by one name and still be able to refer individually to elements in the group as necessary. Such a group is called an array.
An array name is the symbolic name assigned the array when it is defined in a DIMENSION statement, type statement, or COMMON statement (Chapter 3). An array element is one member in the group of data. An array element name is an ar~ ray name qualified by a subscript enclosed in parentheses.
The following table could be produced by rewriting the program in Figure 1~1 to generate four 1~dimensional arrays. The table lists three players, times at bat, hits, and batting averages. Thus the array definitions for these four arrays could be PNAME(3), AB(3), HITS(3), and A VG(3).
PNAME AB HITS AVG
GEHRIG 49 14 .286
OTT60 21 .350
RUTH54 18 .333
We can refer to any element in these arrays by using a subscript. For example, the hits for 'OTT' can be referenced as HITS(2) and the batting average for RUTH as AVG(3).