FORTRAN 77 Language Reference

Null Characters @

Each character string constant appearing outside a DATA statement is followed by a null character to ease communication with C routines. You can make character string constants consisting of no characters, but only as arguments being passed to a subprogram. Such zero length character string constants are not FORTRAN standard.

Example: Null character string:


demo% cat NulChr.f
	write(*,*) 'a', '', 'b'
	stop
	end
demo% f77 NulChr.f
NulChr.f:
 MAIN:
demo% a.out
ab
demo%

However, if you put such a null character constant into a character variable, the variable will contain a blank, and have a length of at least 1 byte.

Example: Length of null character string:


demo% cat NulVar.f
	character*1 x / 'a' /, y / '' /, z / 'c' / 
	write(*,*) x, y, z 
	write(*,*) len( y ) 
	end 
demo% f77 NulVar.f
NulVar.f: 
 MAIN: 
demo% a.out
a c 
  1 
demo%