Usuń węzeł z listy połączonej C
int removeFrameNode(FrameNode** head, char* name)
{
FrameNode* tmp = *head, *prev = NULL;;
int foundNode = FALSE;
while (tmp)
{
if (!strcmp(tmp->frame->name, name))
{
foundNode = TRUE;
break;
}
prev = tmp;
tmp = tmp->next;
}
if (foundNode)
{
if (tmp == *head)
{
*head = tmp->next;
}
else
{
prev->next = tmp->next;
}
free(tmp);
return FOUND;
}
else
{
return NOT_FOUND;
}
}
Proud Platypus