112
Compiler
© 2008 Conrad Electronic
memory. With the following example definition
Dim x(
10
) As Integer
a tenfold memory space has been arranged for variable x. The first memory space can be addressed
by
X[
0
]
, the second by
x[
1
]
, the third by
x[
2
]
, … up to
x[
9
]
. When defining of course other index
dimensions can also be chosen. The memory space of C-Control Pro is the only limit.
Multi dimensional arrays can also be declared by attaching further indices during variable definition,
which have to be separated by commas,:
Dim x(
3
,
4
) As Integer
' array with 3*4 entries
Dim y(
2
,
2
,
2
) As Integer
' array with 2*2*2 entries
Arrays may in BASIC have up to 16 indices (dimensions). The maximum value for an index is
65535
. The indices of arrays are in any case zero based, i .e. each index will start with a
0
.
During program execution there will be no verification whether or not the defined index limits of an
array have been exceeded. If an index becomes too large during program execution the access to
alien variables will be tried which in turn may create a good chance for a program breakdown.
Strings
There is no explicit "String" data type. A string is based on an array of data type Char. The size of
the array must be chosen in such a way that all characters of the string fit into the character array.
Additionally some space is needed for a terminating character (decimal Zero) inorder to indicate the
end of the character string.
Example for a character string with a 20 character maximum:
Dim str1(
21
) As Char
As an exception Char arrays may have character strings assigned to. Here the character string is
placed between quotation marks.
str1=
"hallo world!"
Strings cannot be assigned to multi dimensional Char arrays. There are however tricks for
advanced users:
Dim str_array(
3
,
40
) As Char
Dim Single_str(
40
) As Char
Single_str=
"A String"
Str_StrCopy(str_array,Single_str,
40
) // will copy Single_str in the second string of str_array
This will work because with a gap of 40 characters after the first string there will in str_array be room
for the second string.
Содержание C-Control Pro Mega Series
Страница 1: ... 2008 Conrad Electronic C Control Pro Mega Series ...
Страница 9: ...VIII Inhalt 2008 Conrad Electronic ...
Страница 10: ...Part 1 ...
Страница 17: ...Part 2 ...
Страница 23: ...Part 3 ...
Страница 41: ...32 Hardware 2008 Conrad Electronic 3 3 5 3 Component Parts Plan ...
Страница 57: ...48 Hardware 2008 Conrad Electronic 3 4 5 3 Component Parts Plan ...
Страница 58: ...Part 4 ...
Страница 91: ...82 IDE 2008 Conrad Electronic ...
Страница 92: ...Part 5 ...
Страница 135: ...126 Compiler 2008 Conrad Electronic 31 1F US 63 3F 95 5F _ 127 7F DEL ...
Страница 136: ...Part 6 ...
Страница 231: ...Part 7 ...
Страница 240: ......