String variables are rarely "full", i.e. they rarely contain a string of the maximum length. Fortran pads string variables with spaces to fill the unused elements in the string. Hence, the following two statements are equivalent:
name = 'Alfred E. Neumann' name = 'Alfred E. Neumann '
module constants integer, parameter :: MAX_NAME_LENGTH=10 end module program string_example implicit none character(MAX_NAME_LEN) :: name name = 'Alfred Hitchcock' print *, name end program
Output:
Alfred Hit