The following are data types intrinsic to Fortran:
integer
real
character
complex
logical
integer
, real
and complex
are numeric types.
character
is a type used to store character strings.
logical
is used to store binary values .true.
or .false.
.
All numeric and logical intrinsic types are parametrized using kinds.
integer(kind=specific_kind)
or just
integer(specific_kind)
where specific_kind
is an integer named constant.
Character variables, as well as having a kind parameter, also have a length parameter:
character char
declares char
to be a length-1 character variable of default kind, whereas
character(len=len) name
declares name
to be a character variable of default kind and length len
. The kind can also be specified
character(len=len, kind=specific_kind) name
character(kind=specific_kind) char
declares name
to be a character of kind kind
and length len
. char
is a length-1 character of kind kind
.
Alternatively, the obsolete form for character declaration
character*len name
may be seen in older code, declaring name
to be of length len
and default character kind.
Declaration of a variable of intrinsic type may be of the form above, but also may use the type(...)
form:
integer i
real x
double precision y
is equivalent to (but greatly preferred over)
type(integer) i
type(real) x
type(double precision) y