Example 1: Character strings and arrays of character strings:
CHARACTER*17 A, B(3,4), V(9) CHARACTER*(6+3) C
The above code is exactly equivalent to the following:
CHARACTER A*17, B(3,4)*17, V(9)*17 CHARACTER C*(6+3)
Both of the above two examples are equivalent to the nonstandard variation: @
CHARACTER A*17, B*17(3,4), V*17(9) nonstandard
There are no null (zero-length) character-string variables. A one-byte character string assigned a null constant has the length zero.
Example 2: No null character-string variables:
CHARACTER S*1 S = ''
During execution of the assignment statement, the variable S is precleared to blank, and then zero characters are moved into S, so S contains one blank; because of the declaration, the intrinsic function LEN(S) will return a length of 1. You cannot declare a size of less than 1, so this is the smallest length string variable you can get.
Example 3: Dummy argument character string with constant length:
SUBROUTINE SWAN( A ) CHARACTER A*32
Example 4: Dummy argument character string with length the same as corresponding actual argument:
SUBROUTINE SWAN( A ) CHARACTER A*(*) ...
Example 5: Symbolic constant with parenthesized asterisk:
CHARACTER *(*) INODE PARAMETER (INODE = 'Warning: INODE corrupted!')
The intrinsic function LEN(INODE) returns the actual declared length of a character string. This is mainly for use with CHAR*(*) dummy arguments.
Example 6: The LEN intrinsic function:
CHARACTER A*17 A = "xyz" PRINT *, LEN( A ) END
The above program displays 17, not 3.