问题来源:
http://www.cnblogs.com/del/archive/2008/10/14/1310583.html#1673278
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
Type
TMyByteArr = array of Byte;
procedure Proc(inArr: TMyByteArr; var OutArr: TMyByteArr);
begin
SetLength(OutArr, Length(inArr));
Move(inArr, outArr, Length(inArr));
end;
procedure TForm1.Button1Click(Sender: TObject);
var
arr1,arr2: TMyByteArr;
i: Integer;
str: string;
begin
SetLength(arr1, 3);
arr1[0] := 11;
arr1[1] := 22;
arr1[2] := 33;
Proc(arr1, arr2);
for i := 0 to Length(arr2) - 1 do str := Format('%s %d', [str, arr2[i]]);
ShowMessage(TrimLeft(str)); {11 22 33}
end;
end.