Next: CHARACTER variables
Up: CHARACTER data
Previous: Constants
Character data can be stored in real and integer variables and
arrays. Indeed, until FORTRAN 77, this was the only way of storing
character variables. So statements like :-
ANS='YES'
IF(ANS.EQ.'NO')GOTO 250
are valid. However character handling using reals and integers is rather
clumsy. For example if I and A both contain the string 'XYZ', the expression
I.EQ.A will be false because FORTRAN, not knowing better, assumes I is an
integer and converts it to a real before testing! Also the number of
characters that can be held in one variable is machine dependent: although
most modern machines are based of 32 bits for variables so can
hold 4 characters in a normal length real. It was because of this rather
unsatisfactory state of affairs that a new type of data - CHARACTER was defined
in FORTRAN 77.
n west (APC)
2000-03-08