GURU errors
16-Sep-90 01:23:33
Sb: #465-GURU errors
Fm: Don Curtis/SYSOP 76703,4321
To: Henry Williams 73527,1446
Henry,
You mentioned that it's only on successive entries into the array
that you have a problem…your first entry into it works…or that's the
way I understood your message.
Thus, while your index into the array may be right the first time
thru…going thru it multiple times may cause your index to go out of
bounds…depending on how you use the index, and if it is re-set to zero
(or some in-bounds number). As an example, using the form:
while (a != 29) {
do_something();
a++;
}
can easily get out of bounds, whereas the form:
while (a >= 0 && a < 30 ) {
do_something();
a++;
}
If somehow or other, a started out as 30, the first example would
loop for quite a while…where the second example would not.
continued….