Thanks for your reply. I understand what you're saying. I believe I've already "trouble shot" the other potential pitfalls you mentioned and believe I've isolated the error to the line where I try to assign the NULL pointer (commented in the code from my original post):
Code:
place_holder->previous_node->next_node = NULL;
The destructor is quite simple, it merely frees the dynamically allocated memory so I don't think that is the source of my problem:
Code:
void node_destructor(Node* node)
{
free(node->data);
free(node);
return;
}
I've tested the list with a print function which relies on the NULL termination and that works fine. This leads me to think the list is properly formatted and NULL terminted when I pass it to the remove function (in original post). Further, if remove_node() isn't removing from the last position, it works fine. Everything works until I try to assign the NULL pointer. For reference, here is the print function which works properly:
Code:
void print_list(Node* head)
{
Node* place_holder = head->next_node;
while(place_holder!=NULL)
{
printf("%d\n",*place_holder->data);
place_holder = place_holder->next_node;
}
}