I don’t understand how the array range really limits me, for example this program
program Test;
var
a:integer;
c:array[1..5] of integer;
begin
for a:=0 to 8 do begin
read(c[a]);
end;
for a:=0 to 8 do begin
writeln(c[a]);
end;
end.
for input
1 2 3 4 5 6 7 8 9
writes
1 2 3 4 5 6 7 8 9
(all in a new row because of writeln
) but the array
range should be from 1
to 5
. How does it accept more values then? I also tried with Setlength(c,5)
but same story.
for a:=low(c) to high(c) do
<code>
Newer delphi's might also allow length, defined as high(c)-low(c)+1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With