Original Post
Hey all, I'm having a problem with implementing a Put procedure for an unbounded queue. This is part of a homework assignment, but I've tried to implement it myself and can't make much sense out of the error message I'm presented so I thought I'd ask for help here ( it's weekend and have to turn this in Sunday evening so I can't ask a teacher/student-assistent and most of my friends are behind on their homework ;) ). What's Put supposed to do: Put a new value at the end of the queue. How did I try to implement this: FTail: Points to last element in queue. FNext: Points to next element FVal: Value of element I allocate memory for H, set it's values, make the last element's next pointer point to this new element H, H is now the last element in the queue so make FTail point to that element. What error did I get: It all compiled fine but when I try to use the Put procedure I'm presented a messagebox with the following:
procedure TQueueOfInt.Put(AValue: Integer);
var
H: PCell; // auxiliary pointer to create new cell
begin
//# BEGIN TODO body of Put
...
//# END TODO
end;
procedure TQueueOfInt.Put(AValue: Integer);
var
H: PCell; // auxiliary pointer to create new cell
begin
//# BEGIN TODO body of Put
New( H );
H^.FNext := nil;
H^.FVal := AValue;
FTail^.FNext := H;
FTail := H;
//# END TODO
end;
Quote:So what are my questions: - What is wrong / What does this error message mean? - How do I solve this? Thank you in advance, Arjan
Project Unbounded_Queues_App raised exception class 'External: SIGSEGV'.