Creating an Array: Difference between revisions
Content deleted Content added
m →{{header|Pascal}}: no third level long lines; rm delphi specific (moving to delphi header) |
m →{{header|E}}: moved from pascal |
||
Line 282:
// static array
int[5] = [0,1,2,3,4];
=={{header|Delphi}}==
'''Defining a variable-length array'''
<lang delphi>var
i: integer;
a: array of integer;
begin
readln(i);
SetLength(a, i); { create array }
a[0] := 2; { use it }
if high(a) = i
then
writeln('I expected that.');
else
writeln('Get a better compiler!');
finalize(a);
end</lang>
Delphi dynamic arrays have base 0 index.
=={{header|E}}==
|