Witam, otoz mam pewien problem. Zrobilem liste i gdy dodaje do niej elementy to nie chcą mi się one wyświetlać, oto kod:
procedure dodaj_do_listy(var head:Plist; typ:string);
var p:Plist;
begin
new(p);
p^.Ptyp:= typ;
p^.next:=head;
head:=p;
end;
function ilosc(var p:Plist):cardinal;
var
c:cardinal;
begin
c:=0;
while p<>NIL do
begin
inc(c);
p:=p^.next;
end;
ilosc:=c;
end;
procedure pokaz(p:Plist);
var i:integer;
begin
writeLn('liczba elementow: ',ilosc(p));
i:=1;
writeln(i);
if p <> NIL then
begin
while p <> NIL do
begin
writeln('element #',1, ' dane = ');
inc(i);
p:=p^.next;
end;
end
else
Writeln('pustalista');
end;
Po czym ustawiam liste na nil
PPlist:Plist;
styp:string;
(....)
PPlist:=NIL;
Dodaje i wyswietlam tymi poleceniami. Nie chce mi to śmigać, wypisuje tylko, ze są 4 elementy tej listy, ale jakie nic sie nie wyswietla...
dodaj_do_listy(PPlist,styp);
pokaz(PPlist);
Byłbym wdzięczny za jakieś rady, bo pewnie tu jest jakiś drobny błąd...