next up previous contents index
Next: Storage Units Up: Data Types Previous: Logical Type

Character Type

  The character type is unique in that each character item has a length defined for it: this is the number of characters that it holds. In general the length is fixed when the item is declared and cannot be altered during execution. The only exception to this is for dummy arguments of procedures: here it is possible for the dummy argument to acquire the length of the corresponding actual argument. Using this facility, general-purpose procedures can be written to operate on character strings irrespective of their length. In addition, the rules for character assignment take care of mismatched lengths by truncating or padding with blanks on the right as necessary. This means that the Fortran character type has many of the properties of a genuine variable-length character-handling system.

The maximum length of a character item is system-dependent: it is safe to assume that all systems will allow strings of up to 255 characters, a length limit of 32767 (or even more) is quite common. The minimum length of a character item is one character; empty or null strings are not permitted.

Helen Rowlands