4.5.1 Numeric Type Declaration Statements

Numeric type declaration statements take the following form:

type [*n] v [*n] [/clist/] [,v [*n] [/clist/] ] . . .
type
Is any one of the following data type specifiers:

BYTE  REAL  DOUBLE COMPLEX 
LOGICAL  DOUBLE PRECISION   
INTEGER  COMPLEX   
n
Is an integer that specifies (in bytes) the length of v. It overrides the length that is implied by the data type.

The value of n must specify an acceptable length for the type of v, as listed in Table 2-1. BYTE, DOUBLE PRECISION, and DOUBLE COMPLEX data types have one acceptable length; so, for these data types, the n specifier is invalid.

If an array declarator is used, the n specifier must be positioned immediately after the array name.

v
Is the symbolic name of a constant, variable, array, array declarator, statement function, or function subprogram.
clist
Is a list of constants, as in a DATA statement. If v is the symbolic name of a constant, the clist cannot be present.

Rules and Behavior

A numeric type declaration statement can define arrays by including array declarators in the list.

A numeric type declaration statement can assign initial values to variables or arrays if it specifies a list of constants (the clist). The specified constants initialize only the variable or array that immediately precedes them. The clist cannot have more than one element unless it initializes an array. When the clist initializes an array, it must contain a value for every element in the array.

Examples

In the following example, the first statement declares COUNT and SUM as integers, and MATRIX as a two-dimensional array of integers.

INTEGER COUNT, MATRIX(4,4), SUM
REAL MAN, MU
LOGICAL SWITCH

The next example shows instances where one declaration overrides another. In the first statement, M12*4 and IVEC*4 override INTEGER*2. In the second statement, WX3*4 and WX6*4 override REAL*8. In the third statement, QARRAY is initialized with implicit conversion of the REAL*4 constants to a REAL*8 data type.

INTEGER*2 I, J, K, M12*4, Q, IVEC*4(10)
REAL*8 WX1, WXZ, WX3*4, WX5, WX6*4
REAL*8 PI/3.14159E0/, E/2.72E0/, QARRAY(10)/5*0.0,5*1.0/

For More Information:


Previous Page Next Page Table of Contents