If the node you currently point to is not last, then you can copy the next
node into your node (and delete that one). This has the logical effect of
deleting the node you are pointing to but not the physical effect (you
freed a different block of memory).
If you are pointing to the last node of the list, you must somehow have
access to the next-to-last node so you can reset its "next" pointer.
Of course, it's different (simpler) for double linked lists. Since the
current node has pointers not only to the next node but also the previous
one, you simply set the next node's "previous" pointer to point at the
previous node (or set it to NULL, adjusting the "head" pointer to point at
the next node, if there is no previous node), set the previous node's
"next" pointer to point at the next node (or set it to NULL, adjusting the
"tail" pointer to point at the previous node, if there is no next node),
then remove the current node by setting its "next" and "previous" pointers
to NULL.
--
Dig the sig!
----------- Peter 'Shaggy' Haywood ------------
Ain't I'm a dawg!!