FORTRAN Reference Manual

Statements
FORTRAN Reference Manual528615-001
7-2
Type Declaration Statements—CHARACTER
Type Declaration Statements—CHARACTER
The CHARACTER statement defines a variable, array, RECORD field, symbolic
constant, function name, or dummy procedure as character type.
len
is an unsigned, nonzero positive constant, an integer constant expression enclosed
in parentheses, or an asterisk enclosed in parentheses that specifies the length, in
bytes, of name.
name
is the symbolic name of a constant, variable, array, RECORD field, function, or
dummy procedure.
dimension
is an array bounds specification in the form:
( [ lower:] upper [,[ lower:] upper ]... )
where lower is an integer expression that specifies the lower bound, and upper
is an integer expression that specifies the upper bound of an array dimension.
Considerations
len must be in the range 1 through 255. If you omit the length specification,
FORTRAN assumes the length is one character.
If len is not an integer constant, you must enclose it in parentheses:
PARAMETER (word = 10)
CHARACTER * (word) name, city, state
A length specification following an individual name specifies the number of
characters in that name:
CHARACTER name * 20
A length specification immediately following the word CHARACTER defines the
length of each name that does not specify a length. If name is an array, the length
specification defines the length of each array element.
Using an asterisk for len
When you express the length of name as an asterisk enclosed in parentheses (*):
°
If a dummy argument uses the (*) length specification, the dummy argument
assumes the length of its associated actual argument on each call to the
CHARACTER [* len] name [ dimension ] [* len]
[, name [ dimension ] [* len] ]...