Intel fortran-80 Laptop User Manual


 
FORTRAN-80
Defining Variables, Arrays,
And
Memory
Items in
DATA
lists must agree in
number,
type,
and
length.
'Nlist'
and
'elist'
must
have the same
number
of
items, as the lists correspond one-
to-one.
If
'nlist'
contains
an
array
name without a subscript, 'elist' must have one
constant for each element
of
that
array
(but
see section F.2.9.2). Any subscript
that
is specified must be
an
integer constant.
The
type
of
a name specified in 'nlist' must agree with the type
of
the corresponding
constant in 'elist,' except
that
an
item
of
any type can be initialized
to
a Hollerith
constant.
Given a length
'g'
of
a variable
or
array
element in
'nlist,'
then the length In'
of
its
corresponding initial Hollerith
constant
in 'elist' must be less
than
or
equal to
'g.'
If
'n'
is
less
than'
g,'
the constant
is
padded on the right with blanks until the lengths
are equal. Note
that
initialization
of
a character in a variable
or
array
element in-
itializes
that
entire item.
A variable
or
array element
cannot
be initialized
more
than
once in a
program.
If
two symbols are associated, only
one
may be initialized.
Examples:
DATA
I,J,K/10,20,301
CHARACTER*10
NAMES(3)
DATA
NAMES/'GEHRIG',
'OTT', 'RUTH'I
INTEGER*1 ZEROS
(10)
DATA ZEROS 110*0/1,J,K
110,20,301
&NAMES(2) I'OTT'I
C AMPERSAND USED TO CONTINUE STATEMENT
LOGICAL TABLE(3)
DATA
TABLE
I.TRUE., .TRUE., .FALSE.!
3.4 Memory Definition
The
DATA
and
assignment statements assign values to specific items.
FORTRAN
also ineludes three statements for establishing memory areas
and
initializing these
areas. These are the
EQUIVALENCE,
COMMON,
and
BLOCK
DATA
statements.
EQUIVALENCE
is
used
to
associate two
or
more
items in memory, such as
associating a variable
name
with
an
array element. Its scope
is
the
program
unit in
which it appears. The
COMMON
statement can be used
to
associate items in
dif-
ferent
program
units, allowing
common
use
of
data
and
memory
through
an
entire
program
(for example, a
common
data
base
or
table). BLOCK
DATA
defines a
BLOCK
DATA
subprogram,
which can assign initial values to items in
common
memory.
3.4.1 EQUIVALENCE Statement
The
EQUIVALENCE
statement allows items in a
program
unit
to
share memory.
All entities listed in the
EQUIVALENCE
statement share the same start address in
memory (even
if
they are
of
unequal lengths).
The
format
of
the
EQUIVALENCE
statement is:
EQUIVALENCE
(nlist)
[,(nlist)] ...
3-11