//fpc 3.0.4
program test06;{ direct grow of the chain}
const M=9; {number of element of the chain}
type spisok=^element;
mas=array[1..M] of integer;
element=record
info: integer;
sled:spisok;
end;
var pervy, a: spisok;
x,d:mas;
i:integer;
begin
for i := 1 to M do x[i]:=i;
New(pervy);
new(a);
a^.sled:=nil;
pervy:=a;
for i:= 1 to M do
a^.info:=x[i];
new(a^.sled);
a:=a^.sled;
dispose(a);
while pervy^.sled<>nil do
d[i]:=pervy^.info; write(d[i]:5,' ');
pervy:=pervy^.sled;
{for i:=1 to M do write(d[i]:5, ' ');}
writeln;
dispose(pervy);
end.
1 2 3 4 5 6 7 8 9