float **bb;
float *z;
下面这句
*(*(bb+i)+j)=*(z+k);
如何用DELPHI表示?
定义为
bb:^PDouble;
z:PDouble;
再问一个很菜的问题,在过程定义中不能使用数组指针吗?
入
procedure abc(aa:^PDouble);
float *z;
下面这句
*(*(bb+i)+j)=*(z+k);
如何用DELPHI表示?
定义为
bb:^PDouble;
z:PDouble;
再问一个很菜的问题,在过程定义中不能使用数组指针吗?
入
procedure abc(aa:^PDouble);
PPDouble = ^PDouble用PPDouble就可以做参数了
var
A : ^pinteger;
begin
A := @Button1;
Tbutton(A^).click;
end;
procedure abc(var aa: PDouble);在d2009以前,delphi中只有字符型的指针(PAnsiChar、PWideChar)可以直接使用 +、-、[] 等运算符,其它的只能通过 Inc、Dec、^ 来操作,这一点不同于c
在c中,a[b] 运算符和 *(a+b) 是等效的(也就是说,p[5]和5[p]都相当于*(p+5)),所以上面的式子相当于
bb[i][j] = z[k];我自己在d2009之前处理不需要密集计算的指针的时候,使用了这种trick:type
PDoublePlus = class
private
function GetData(Index: Integer): Double;
function GetAddr(Index: Integer): PDouble;
procedure SetData(Index: Integer; const Value: Double);
public
property Addr[Index: Integer]: PDouble read GetAddr;
property Data[Index: Integer]: Double read GetData write SetData; default;
end;...{ PDoublePlus }function PDoublePlus.GetAddr(Index: Integer): PDouble;
begin
Result := PDouble(Self);
Inc(Result, Index);
end;function PDoublePlus.GetData(Index: Integer): Double;
begin
Result := Addr[Index]^;
end;procedure PDoublePlus.SetData(Index: Integer; const Value: Double);
begin
Addr[Index]^ := Value;
end;在使用的时候,对于
var p: PDouble;
采用 PDoublePlus(p)[n] 的方式进行读写