Z
zyx0404
Unregistered / Unconfirmed
GUEST, unregistred user!
我定义了一个动态指针数组
TnNumbersArray = array of array of Integer;
PnNumbersArray = ^TnNumbersArray;
定义函数
function GetCount(pnAryNumbers : PnNumbersArray; nBoundLow1, nBoundUpper1, nBoundLow2, nBoundUpper2 : integer) : integer;
var
i, j, nNumber : Integer;
nLength1, nLength2 : integer;
begin
nLength1 := nBoundUpper1 - nBoundLow1 + 1;
nLength2 := nBoundUpper2 - nBoundLow2 + 1;
for i := 0 to nLength1 - 1 do
begin
for j := 0 to nLength2 - 1 do
begin
nNumber := nNumber + pnAryNumbers[i + nBoundLow1, j + nBoundLow2];
end;
end;
Result := nNumber;
end;
在函数中pnAryNumbers[i + nBoundLow1, j + nBoundLow2];这么写编译不通过,错误信息是"Array type required"
如果写成pnAryNumbers^[i + nBoundLow1, j + nBoundLow2];那运行时会出错
我只有很少的分了
TnNumbersArray = array of array of Integer;
PnNumbersArray = ^TnNumbersArray;
定义函数
function GetCount(pnAryNumbers : PnNumbersArray; nBoundLow1, nBoundUpper1, nBoundLow2, nBoundUpper2 : integer) : integer;
var
i, j, nNumber : Integer;
nLength1, nLength2 : integer;
begin
nLength1 := nBoundUpper1 - nBoundLow1 + 1;
nLength2 := nBoundUpper2 - nBoundLow2 + 1;
for i := 0 to nLength1 - 1 do
begin
for j := 0 to nLength2 - 1 do
begin
nNumber := nNumber + pnAryNumbers[i + nBoundLow1, j + nBoundLow2];
end;
end;
Result := nNumber;
end;
在函数中pnAryNumbers[i + nBoundLow1, j + nBoundLow2];这么写编译不通过,错误信息是"Array type required"
如果写成pnAryNumbers^[i + nBoundLow1, j + nBoundLow2];那运行时会出错
我只有很少的分了