//这段代码在Delphi 2007和delphi 7下是可以执行的,所以正确使用结构体数组和指针应该是这样的,已验证

unit Unit1; interface uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls; type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; var
Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject);
type
TMyType = record
S: String;
I: Integer;
end;
TMyArray = array of TMyType;
PMyArray = ^TMyArray; var
MyArray: PMyArray;
i:integer;
AList:TStrings;
begin
try
new(MyArray);
AList:=TStringList.Create;
SetLength(MyArray^, );
for i:= to do
begin
MyArray^[i].S :='中山'+inttostr(i);
myArray^[i].I :=i;
AList.Add(MyArray^[i].S+',年龄为:'+inttostr(MyArray^[i].I));
end;
self.Memo1.Lines:=Alist;
finally
SetLength(MyArray^, );
Dispose(MyArray);
end; end; end.

这段代码在Delphi 2007和delphi 7下是可以执行的,所以正确使用结构体数组和指针应该是这样的,已验证。

最新文章

  1. [LeetCode] Two Sum 两数之和
  2. 浅析SQL SERVER执行计划中的各类怪相
  3. Python学习day3作业
  4. UVA 11859 Division Game[Nim游戏]
  5. C#中的可空值类型
  6. 手把手教你使用Git
  7. Android Tab -- 使用Fragment、FragmentManager来实现
  8. NFS服务器搭建
  9. 03-图片浏览器(plist的简单应用)
  10. 21、HierarchyViewer使用记录
  11. 深入理解jsavascript的作用域
  12. [NOIP2005]采药
  13. android Services注意地方
  14. Oracle关联查询关于left/right join的那点事
  15. SQL server 数据库——表连接(多表横向连接,纵向连接)
  16. 全球第一款纯数据GPRS模块 有方M590 概述
  17. Std::map too few template arguments
  18. max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
  19. spring默认为单例模式
  20. 数位DP模板详解

热门文章

  1. URI和URL的区别
  2. 关于P,V操作理解的分析
  3. 关于Scala JDK与IDEA版本兼容的问题
  4. 用SQL语句添加删除修改字段
  5. A strange lift
  6. 枚举 POJ 2965 The Pilots Brothers' refrigerator
  7. HDU2841 Visible Trees(容斥原理)
  8. 模板模式(C++) 【转】
  9. slice、substring和substr
  10. git 远程版本库