Variable Length Storage with Fixed Maximum
The storage of variable-length strings in memory cells with fixed lengths can be done in two general ways:
- One can use a marker, such as two dollar signs ($$), to signal the end of the string.
- One can list the length of the string- as an additional item in the pointer array, for example.
Program printing two integers in increasing order:
- READ *, J, K
- IF (J.LE.K) THEN
- PRINT *, J, K
- ELSE
- PRINT *, K, J
- ENDIF
- STOP
- END
Post a Comment