More On Character Strings; Di Mensioning Strings; Concatenation - Sharp PC-1500A Instruction Manual

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

Advertisement

All
and more
about Sharp PC-1500 at
http:f/www.PC-1500.info
NOTES:
Two-d
imensional
arrays
can rapidly
eat
up
storage space.
For
exam
ple. an array
with 25 rows
and
35
columns
uses 875 storage locat
ions!
Arrays
are very
pawerful programming
tools.
For a
more
complete treatment of
arrays,
we
recommend supplementary
reading.
The
following table
shows the number of
bytes used
to define
each variable and
the
number
used by
each
program
statement.
Variable
Variable name
Data
Numeric
variable
7
bytes
8
bytes
String
variable
7
b ytes
Array
variable
Specified
n umber of bytes
2
characters
variable
16
bytes
For
example,
if
DIM
ZS
(2,
3)
*
10
is
specified.
12
variables. each
capable
of string
10
chara·
cters,
are
r~s~rv1?d.
This requires
7
bytes
(variable
name)
+
10
bytes
(number
of characters)
x
12
=
127
bytes.
Element
Line
number
St.atement
&
function
Others.
I
••n
)
Number of bytes
used
3
bytes
2
bytes
1
byte
B.
MORE
ON CHARACTER STRINGS
8
.1.
OIMensioning
Strings
Ch aracter
strings are
lim
ited. by
default. to sixteen ch
aracters
in le
n91h.
By
d imensioning
a
character
string it
is
P0'5ible to
create
a string
whose
length
is
up
to
80
character·s.
Reductions
in
string lcng1h,
10
conserve
memory
space.
are
also
possible.
The
length
of a
st ring
is specified
in
the
DIMension
starnmcnt
as
follows
:
DIM
variable·name
(bound)* length
where:
variab!c•name is the name of the character
string
array.
bound
is
the
maximum subscript
o
f
the array.
length
is the
length of
each
string
YJithin
the
array.
If
o
nly one
string
is
needed,
on
array with
one
c lement
{subscripted
as
e lement
iero)
may
be
speci
fied
to
conserve memory
space.
This
is
illustrated by
the following declaration
of
a
26
character
string
:
DIM AS(01
*
26
8.2. Concatenation
Several
characte
r strings (or characters
within
character variables) can be joined
to form a single
string.
This "adding" of
character
strings
is called
"concatenation".
The
form
for
concat~nation
is
:
variable : ; : : : ; :
char.'.lcter·string
charac
tar-variable
+
character-string
charactcr-va riable
Example
1:
10
SS
=
"SUPER
"
20
TS
=
SS+ "MAN"
30
PRINT
TS
Do not sale this PDF!!!
70

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents