You can use Dynamic Arrays. Use High(myarray) and Low(myarray) to get the array bounds in your method or procedure etc. This enables you to work with any size of array.
Here's some very basic code to demonstrate this way to solve your problem: Procedure ShowTheArray(a : array of extended); Var S : string; i : integer; begin S:=''; for i:=low(a) to high(a) do S:=S+Format('Array[%d] = %n',[i,a[i]])+#13#10; Showmessage(S); end; procedure TForm1.Button2Click(Sender: TObject); Var i: integer; MyArray : array of extended; begin Setlength(MyArray, 10); // Array now has 10 elements, 0 to 9. // Use Low and High to auto size the loop parameters // (works for static arrays also) Randomize; for i:=low(MyArray) to high(MyArray) do MyArray[i]:=random*100000000; ShowTheArray(MyArray); end; Regards, Brendan. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stan Sent: 23 December 2006 16:59 To: delphi@elists.org Subject: Passing an array Hi, I am writing a routine to manipulate an array of type extended. Various other routines will call this routine, and the size of the array to be passed will vary. How can I pass an array to this routine? Something like, pass the size of the array and the location of the first value, so the routine's calling sequence would be something like (var N : integer; var Arr : ???). I want to be able to call it with, for example, an array defined in the calling program as "var Arr1 : array[1..100] of extended" and also later with an array defined as "var Arr2: array[1..750] of extended". How do I define the routine so that it can accept and work with an array of any size? Thanks, -- Stan _______________________________________________ Delphi mailing list -> Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi _______________________________________________ Delphi mailing list -> Delphi@elists.org http://www.elists.org/mailman/listinfo/delphi