Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

remove node from linked list 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;
	}
}
Source by www.log2base2.com #
 
PREVIOUS NEXT
Tagged: #remove #node #linked #list
ADD COMMENT
Topic
Name
9+2 =