integer list of variables
real list of variables
double precision list of variables
complex list of variables
logical list of variables
character list of variables
The list of variables should consist of variable names separated
by commas. Each variable should be declared exactly once.
If a variable is undeclared, Fortran 77 uses a set of implicit
rules to establish the type. This means all variables starting
with the letters i-n are integers and all others are real.
Many old Fortran 77 programs uses these implicit rules, but
you should not! The probability of errors in your program
grows dramatically if you do not consistently declare your variables.
Fortran 77 has two different types for floating point variables, called real and double precision. While real is often adequat, some numerical calculations need very high precision and double precision should be used. Usually a real is a 4 byte variable and the double precision is 8 bytes, but this is machine dependent. Some non-standard Fortran versions use the syntax real*8 to denote 8 byte floating point variables.
program circle
real r, area, pi
parameter (pi = 3.14159)
c This program reads a real number r and prints
c the area of a circle with radius r.
write (*,*) 'Give radius r:'
read (*,*) r
area = pi*r*r
write (*,*) 'Area = ', area
stop
end
The syntax of the parameter statement is
parameter (name = constant, ... , name = constant)
The rules for the parameter statement are:
A5, 5A, VARIABLE, XY3Z4Q, AT&T, NUMBER1, NO1, NO 1, NO_1, STOP