RosettaCodeData/Task/Doubly-linked-list-Element-insertion/Ada/doubly-linked-list-element-insertion-1.ada
Ingy döt Net 764da6cbbb CDE
2013-04-10 16:57:12 -07:00

11 lines
332 B
Ada

procedure Insert (Anchor : Link_Access; New_Link : Link_Access) is
begin
if Anchor /= Null and New_Link /= Null then
New_Link.Next := Anchor.Next;
New_Link.Prev := Anchor;
if New_Link.Next /= Null then
New_Link.Next.Prev := New_Link;
end if;
Anchor.Next := New_Link;
end if;
end Insert;