Hello-
I have a double link list which builds in sorted order.
It works fine and dont think there are bugs.
But, I am really struggling with code to delete a node.
I am particularly having difficulty with deleting the 2nd node if there are 3 or more nodes present.
I have tried this code below, which also appeared in a C Reference text, but it wont work
I can post the code for the whole program if that will help.
Appreciate any enlightenment,
Thank you,
Bozz
Code:void deleteDLStudent(void) { DL_STUDENT* info = NULL; info = search(start); //info is pointer(record) to delete //start->prev = NULL; if(info) { if(info == start) //deleting first link { start = info->next; if(start) // if at least 1 link start->prev = NULL; else // else 'info' was the only link end = NULL; } else { if(info->prev) info->prev->next = info->next; if(info != end) info->next->prev = info->prev; else end = info->prev; } free(info); } print(start, end); return; }
Code tags added by Hammer



LinkBack URL
About LinkBacks




.