On 25 Feb 2012, at 13:23, leledumbo wrote:
> The code results in AV in the last WriteLn. Is this correct (i.e. intended
> behavior)?
Yes.
> If yes, what is the correct way to have the PR^.avl initialized
> just like TR.avl and x?
Use new(PR) instead of GetMem(SizeOf(TRuang)), or alternatively
On Sat, 25 Feb 2012 04:23:24 -0800 (PST)
leledumbo wrote:
> 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;
>
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 := GetM