Nope, still doesn't work! It doesn't delete the node i want when it does exist, but it does return 0 when i try to delete a non-existing node.
I colored the new lines of code red
Code:
int Delete(node *table[], int key)
{
node *temp, *del, *save;
int i;
int test = 0;
for (i=0; i<10; i++)
{
temp = table[i];
if (temp != NULL)
{
while (temp && temp->key != key)
{
del = temp;
temp = temp->next;
}
if (temp == NULL) continue;
else if (temp->key == key)
{
save = temp;
del->next = temp->next;
free(save);
test = 1;
}
}
else continue;
}
return(test);
}