91
Generale / Re:Inizializzazione array di record
« Ultimo post da Narciso il Marzo 09, 2025, 07:35:09 am »guarda un po'...
Codice: [Seleziona]
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls;
type
{ TForm1 }
TForm1 = class(TForm)
Button2: TButton;
procedure Button2Click(Sender: TObject);
private
type tpippo = record
a:integer;
b:string[20];
end;
Var A_pippo:array of tpippo;
public
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button2Click(Sender: TObject);
var x:integer;
begin
setlength(a_pippo,0);
for x:=0 to 9 do begin
setlength(a_pippo,x+1);
a_pippo[x].a:=x;
a_pippo[x].b:=inttostr(x);
end;
showmessage(inttostr(length(A_pippo)));
end;
end.