My list item:
typdef struct sNode
{
struct sNode* next;
myData data;
} tNode;
I wish to implement the following API:
bool removeNode(tNode* node)
{
... // need to fix list and free node
}
The problem is that I do not have the previous element to modify.
Is there some kind of magic to solve it?
No. You would have to traverse from the beginning of the list to find the previous node, which is pretty inefficient. This is the problem with singly-linked lists. If you need this to be fast, use a doubly-linked list (each node has a next and a previous pointer).