Delphi自定义函数返回数组解决方法
一月 27, 2010 at 7:50 下午
—
Easton
type
TArr = array of integer;
function abc(a:integer):Tarr;
var
tempArr:TArr;
begin
setlength(tempArr,2);
tempArr[0] := a;
tempArr[1] := a + 10;
result:=tempArr;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
a : integer;
begin
a := 5;
showmessage(inttostr( abc(a)[0] )); //5
showmessage(inttostr( abc(a)[1] )); //15
end;
e0809798-36a8-4a70-a75b-851663f210fa|0|.0|96d5b379-7e1d-4dac-a6ba-1e50db561b04
Posted in: 技术文章
Tags: Delphi, 函数, 自定义函数, 返回数组