Sharp PC-1500 Instruction Manual page 71

Hide thumbs Also See for PC-1500:
Table of Contents

Advertisement

All
and
more
about Sharp
PC-1500
at
http://www.PC-1500.info
In
this
e xal'npfe.
the
va
ri
able
I
is
used
to
sel
ect
..
,.,hich storage location
\•Jill
hold
the
result
and
i
t
is
also
bei
ng used
to
compute the
result.
To
dcclarn a
chJracwr
array
a
slightly
dif
foreirn
form
of
the
DIM
statement
is
used
:
DIM
character·vari
able
-narne (size
)* length
where
:
character
·var
iable·name
is
a
variable
name
\.vh
ich conforms to
the
rules for
n
ormal
character
variables
as
discussed previously
.
~
is
t
he n
u
mber
of
storage
locations
and
must
be
in
the
range
0
th
rough 255.
Note that
when you
speci
fy
a
nu 1nber.
you get
one
more
location
thar-.
you
specified.
*length
is
optional
.
If
used.
it specifies
th
e
length
of
each o
f
the
strings
that
comprise
the
array.
Length
is
a
number in the
r.ange
1
to
80.
If
th is
clause
is
n
ot
used. the
strings,
will have
the
default
length
o
f
16
characters.
Examp
les
o
f
legal
character array declarations
afe
:
DIM XS (4)
DIM
NM$
(10)
*
10
DIM
IN$
11)
*
80
DIM
RS
IO)*
26
The
fi
fSt
exa1nple
creates
an
array
of
five
S"tri ngs
each
able
to stofe
16
characters.
The
second
D
IM
statement declares
an
array
NM
with
eleven
strings of
10
c haracters each
.
Expfici.t
definition
of
StfiHgs
smaller
than
the default
hefJ)S to
conserve memory
space.
The third example
declares
'a
tw
o
c
lement
a
rray of
BO·ch
afacter
strings
and
the
last
example
declares
a
single string
of
t\venty·
six
characters
{see
Section
B.
I.).
Besides
the
simple
arrays
\~.re
h
ave
just
st
udied,
t
he
PC·1500 allo
..
vs
"t.,,vo·dimcnsional"
a
rrays.
By analogy.
a
one·dimensional
array
is
a
list
o
f
data arranged in
a
single
column.
A
two·d imcn·
sional
array is
ai
table of
dat
a with ro\vs
and
colu
mns.
The ty.•o
·d
imensional
array is declared
by
the
statement
:
DIM
numcric ·va ri.:iblc
.n
amc
(fo1;vs,
columns)
or
DIM
character·v.
a
riable-n arne
(rows,
columns)
*'
length
where
:
fOws
speci
fies the
number of
rov.rs
in
the
a rray.
This
must be
a
number
in
the range
O thfough
255_
Note
t
hat
when you
speci
fy t:he
number
of
rows you
get
one
more
row than
the
specification.
colun1ns
specifies
the nurnber of
col umns
in
the
array.
This
must
be a
number in
the rangt: 0
through
255.
Note
that ..
vhen
you
specify
the numbef
of
columns
you
get
one
more
column than
the specification.
The follow
in9
diagram illustrates
the st
orage
locat ions
that
result
from
the
-declaration
DI
M
T
(2.
3)
and
the subscripts
(now
composed
o
f
two
nu mbers) w
hich
pertain
to
each
sto rage
location
:
69
Do not sale this PDF
!!!

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents