例如
有一记录类型如下
Type PTCellsType=record
col:integer;
row:integer;
end;如果是这个函数
procedure aa(NotCells :array of integer);
我调用是可以
aa([1,2,3]);
这样传参那如果其参数为记录数组(如下),那我将如何按上述样式传参
procedure Cell(cells :array of PTCellsType); Cell([????]);
谢谢!!!
有一记录类型如下
Type PTCellsType=record
col:integer;
row:integer;
end;如果是这个函数
procedure aa(NotCells :array of integer);
我调用是可以
aa([1,2,3]);
这样传参那如果其参数为记录数组(如下),那我将如何按上述样式传参
procedure Cell(cells :array of PTCellsType); Cell([????]);
谢谢!!!
P1,P2,P3:PTCellsType
给变量赋值,然后就可传递差数了
///////////////
要注意:传递的是记录型的指针
Type pPTCellsType=^PTCellsType
PTCellsType=record
col:integer;
row:integer;
end;
调用函数可以定义成procedure Cell(cells :pPTCellsType);
调用:var aa: array of PTCellsType
aa[0].col:=1;
aa[0].row:=2;
aa[1].col:=3;
aa[1].row:=4;
........
cell(@aa) ;
OK,给分吧
pPTCellsType只是记录的指针,而不是记录数组的指针,所以是错的。
怎么会错的呢?我都用了很久了,我现在写的一个程序都是记录数组。
cell(@aa) 传递的就是树组的地址,哪里错了?
const
a1:PTCellsType=(col:10;row:10);
a2:PTCellsType=(col:11;row:11);
a3:PTCellsType=(col:11;row:13);Cell([a1,a2,a3]);
能不能在简洁点
(能不能用一行语句解决)
能不能在简洁点
(能不能用一行语句解决)太贪心了!花儿的方法不是挺好摩?
414
Cell([(col:10;row:10),(col:10;row:10),(col:10;row:10)]);
Cell([(PTCellsType)(col:10;row:10),(PTCellsType)(col:10;row:10),(PTCellsType)(col:10;row:10)]);
Cell([PTCellsType(col:10;row:10),PTCellsType(col:10;row:10),PTCellsType(col:10;row:10)]);
或者什么其他的。 :P