Consider the following program:

{$mode objfpc}
type
  TJam = array of Integer;

  TRuang = record
    nm_ruang: string;
    avl: TJam;
  end;

  PRuang = ^TRuang;

var
  x: array of integer;
  TR: TRuang;
  PR: PRuang;
begin
  try
    WriteLn(Length(x));
    WriteLn(Length(TR.avl));
    PR := GetMem(SizeOf(TRuang));
    WriteLn(Length(PR^.avl));
  finally
    FreeMem(PR);
  end;
end.


The code results in AV in the last WriteLn. Is this correct (i.e. intended
behavior)? If yes, what is the correct way to have the PR^.avl initialized
just like TR.avl and x?

--
View this message in context: 
http://free-pascal-general.1045716.n5.nabble.com/dynamic-array-as-a-part-of-dynamically-allocated-records-behavior-tp5515029p5515029.html
Sent from the Free Pascal - General mailing list archive at Nabble.com.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to