Delphi结构体数组指针的问题

//这段代码在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^, 50000); for i:=0 to 49999 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^, 0); Dispose(MyArray); end; end; end.

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