Ok, you have problems with you add function as well.
If this is what you have:
Code:
NODE new_list_add(NODE *sent, NODE *high)
{
NODE *new_node;
new_node = (NODE *)malloc(sizeof(NODE));
sent->prev->next = new_node;
new_node->prev = sent->prev;
new_node->next = sent;
sent->prev = new_node;
new_node->total = high->total;
}
Firstly, you want to be returning a pointer to your new_node, not a NODE struct.
Next, you need to figure out whats linking to where.
"sent" would be the head of your sorted list.
"high" would be the node to add.
So, "sent->next" should point to new_node and "new_node->prev" should point to "sent"
since you have a doubly linked list "new_node->next" should be set to NULL to terminate the list.
Once you have created your new node, you should return the pointer to it as it will be the new head of your list.
I think you want something like:
Code:
NODE* new_list_add(NODE *sent, NODE *high)
{
NODE *new_node;
new_node = (NODE *)malloc(sizeof(NODE));
sent->next = new_node;
new_node->prev = sent;
new_node->next = NULL;
new_node->total = high->total;
return new_node;
}
On a side note, in relation to delete_current, it should probably be declared void as it does not return anything. IE:
Code:
void delete_current(NODE *current)