With Delphi/FPC you have a few choices:<br><br>Fixed length arrays, dynamic length arrays, and variant type arrays <br><br>Fixed length arrays cannot be resized and their lower and upper bounds are immutable. The lower and upper bounds can start at any ordinal position. The upper bound can ever be less than the upper bound. Also, you may use ordinal types as the bounds. Examples:<br>
<br>var<br> ZeroBased: array[0..9] of Integer;<br>
OneBased: array[1..10] of Integer;<br>
Balance: array[-1..1] of Integer;<br> Data: array[Byte] of Byte;<br> BoolStr: array[Boolean] of string;<br><br>Dynamic length arrays are a managed type. That is to say the compiler generates to code to ensure the memory owned by the array is released when a procedure exits (if the array is a local). Kind of like the managed string type. You can use the SetLength() and Length() functions to resize/query them. You can also set them to nil, meaning an empty array. They cannot be used in a const block unless you set them to nil (which is kind of useless). Unlike the managed string type dynamic arrays do not copy on write. Dynamic arrays always use zero based indexing. Examples:<br>
<br>var<br> Names: array of string;<br> JaggedInts: array of array of Integer;<br><br>Both High and Low functions cna be used with fixed and dynamic arrays. Example:<br><br>for X := Low(JaggedInts) to High(JaggedInts) do<br>
for Y := Low(JaggedInts[X]) to High(JaggedInts[X]) do<br> DoSomething(JaggedInts[X, Y]);<br><br>Variant type arrays are variants which reference TVarData having a VType of varArray. The following functions are used to manage variant arrays:<br>
<br>VarArrayCreate<br>VarArrayOf<br>VarArrayDimCount<br>VarArrayLowBound<br>VarArrayHighBound<br>ect<br><br>