hi there
i have an array of linked lists, 10 of them to be precise. insertion works beautifully but deletion is a problem.
i want a function which returns an int upon deletion. 0 if the node is not in the array or 1 if it is and it was deleted. but, of course, it doesn't work.
here is my code:
Code:int Delete(node *table[], int key) { node *temp, *del; int i; int test = 0; for (i=0; i<10; i++) { temp = table[i]; if (temp != NULL) { while (temp->key != key && temp != NULL) { del = temp; temp = temp->next; } if (temp == NULL) continue; else if (temp->key == key) { del->next = temp->next; free(temp); test = 1; } } else continue; } return(test); }



LinkBack URL
About LinkBacks




