A type statement can be used to:
Confirm or to override the type established by default or by the IMPLICIT statement
Specify dimension information for an array, or confirm the type of an intrinsic function
Override the length by one of the acceptable lengths for that data type
A type statement can assign initial values to variables, arrays, or record fields by specifying a list of constants (clist) as in a DATA statement. @
The general form of a type statement is:
type VariableName / constant /
type ArrayName / constant, /
type ArrayName / r*constant /
CHARACTER LABEL*12 / 'Standard' / COMPLEX STRESSPT / ( 0.0, 1.0 ) / INTEGER COUNT / 99 /, Z / 1 / REAL PRICE / 0.0 /, COST / 0.0 / REAL LIST(8) / 0.0, 6*1.0, 0.0 /
When you initialize a data type, remember the following restrictions:
For a simple variable, there must be exactly one constant.
If any element of an array is initialized, all must be initialized.
You can use an integer as a repeat factor, followed by an asterisk (*), followed by a constant. In the example above, six values of 1.0 are stored into array elements 2, 3, 4, 5, 6, and 7 of LIST.
If a variable or array is declared AUTOMATIC, then it cannot be initialized.
INTEGER Z / 4 / POINTER ( x, Z ) Warning issued, not initialized
In this case, the compiler issues a warning message, and Z is not initialized.
If a variable or array is not initialized, its values are undefined.
If such initialization statements involve variables in COMMON, and the -ansi compiler flag is set, then a warning is issued.
Compiling with any of the options -dbl, -r8, -i2, or -xtypemap can alter the default size of names typed without an explicit size. See the discussion in Chapter 2.