Fixed Format and Free Format of Fortran Code
Fortran used a fixed format in the early stage. From F90 onwards, the free format source code is recommended. However, the format is only the representation of the source code and is not necessarily related to syntax standards such as F77, F90, and F95. The differences between the fixed format and free format are shown in Differences between the fixed format and free format:
Item |
Fixed Format |
Free Format |
|---|---|---|
Compilation option control |
-ffixed-form |
-ffree-form |
Extension |
.for .f … |
.f90 .f95 .f03 … |
Syntax |
F66, F77, F90, F95, F03, F08 |
F66, F77, F90, F95, F03, F08 |
Format |
The code starts from the seventh character position. |
Any |
Continuation line |
Enter a non-zero character in the sixth character position. |
Add & at the end of the previous line. |
Row width |
72 |
132 |
Comment |
Use the letter C, c, or * at the beginning of a line. |
Add an exclamation mark (!) before a comment. |