[fpc-pascal]a problem about pascal programing

Shifted Soul snsii at yahoo.fr
Sat Dec 15 18:48:32 CET 2001


As I seen "Items" is not a type, it have to be a constant array.
This is your program with some changes.
-------------- next part --------------
program the_linked_list;
type node=record
          data:integer;
          link:^node;
          end;
{You have to mak this as a typed constant}
const
     items : array [1..4] OF Integer = (1,2,3,4);

var header,p,x,y:^node;
    item:items;
    i:integer;
    found:boolean;
begin
     header:=nil;
     for i:=4 downto 1 do
     begin
	  {When you use an array you have, then to use [ & ] instead of ( & )}
          item:=items[i];
          new(p);
          p^.data:=item;
          p^.link:=header;
          header:=p;
     end;
end.
{ If you want any help you can tell me}


More information about the fpc-pascal mailing list