首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

C结构转Delphi有关问题

2012-02-04 
C结构转Delphi问题/* Number array: an array of floats */struct Numa{l_int32nalloc/* size of allocat

C结构转Delphi问题
/* Number array: an array of floats */
struct Numa
{
  l_int32 nalloc; /* size of allocated number array */
  l_int32 n; /* number of numbers saved */
  l_int32 refcount; /* reference count (1 if no clones) */
  l_float32 *array; /* number array */
};
typedef struct Numa NUMA;

如此C结构,其后有在基于结构上的操作,array是一个浮点指针,也是一个浮点数组名

请问如何更改这段代码,用记录还是类好?
结构中前3项都是围绕第4项的

[解决办法]
记录
[解决办法]
用记录
NUMA = record
nalloc, n, refcount: Integer;
p:^float;
end;

[解决办法]
Numa=record
a:intege;
b:intege;
c:intege;
end;
var
d:^numa;
[解决办法]
Numa=record 
nalloc:integer; 
n:integer; 
refcount:integer; 
_array: Array of float; //array 是delphi的关键字, 所以这里应该用别的名字。
end; 

热点排行