- Code: Select all
//type list of Path
Ppath=^Tpath;
data=record
lintasan:string;
plintasan:real;
state:integer;
id:integer;
end;
Tpath =record
Next : Ppath;
Info : data;
end;
ListPath=record
First : Ppath;
end;
i got the access violation message when i try to manipulate my linked list like this
- Code: Select all
procedure testlistpath(var lpa:listpath)
var
x:integer;
temppath,newpath:ppath;
begin
x:=5;
while(x<=nbs)do begin
GetMem(newpath,SizeOf(Tpath));
Allocpath(newpath);
newpath^.Info.id:=x;
newpath^.Next:=nil;
if(not(Assigned(LPa.First))) then begin
Lpa.First:=newpath; temppath:=Lpa.First;
end else begin
temppath^.Next:=newpath;
temppath:=temppath.Next;
end;
x:=x+1;
end;
end;
- Code: Select all
procedure Allocpath(item :Ppath);
//mengalokasikan sebuah path
begin
new(item);
item^.Info.lintasan:='';
item^.Info.plintasan:=100;
item^.Next:=nil;
end;
please help urgently got problems with deadline