Singly-linked list/Element removal: Difference between revisions

Content added Content deleted
(Added a basic task description)
m (→‎{{header|Fortran}}: Clarify knowledge about the linked-list.)
Line 55: Line 55:


WRITE (6,*) "Off with the head!"
WRITE (6,*) "Off with the head!"
CALL LLREMOVE(LINK,3)
CALL LLREMOVE(LINK,LINK(0)) !LINK(0) fingers the head element.
CALL LLFOLLOW(LINK)
CALL LLFOLLOW(LINK)


WRITE (6,*) "And off with the tail."
WRITE (6,*) "And off with the tail."
CALL LLREMOVE(LINK,5)
CALL LLREMOVE(LINK,5) !The tail element is not tracked.
CALL LLFOLLOW(LINK)
CALL LLFOLLOW(LINK) !But, I know where it was, in this example.


END
END</lang>
</lang>
Output:
Output:
<pre>
<pre>