This is how i defined the linked list:
Code:
/*structure of linked list*/
struct node{
char data[9];
struct node *next;
};
typedef struct node NODE;
and this is the deletenode function:
Code:
void deletenode(NODE *temp1, char string[9])
{
NODE *temp2;
for(;temp1->next;temp1=temp1->next){
if(strcmp(temp1->next->data, string)==0){
temp2=temp1->next;
temp1->next=temp1->next->next;
free(temp2);
return;
}
}
printf("deletenode(%s) - data not found in list, could not delete", string);
}
I tried using the deletenode function in a smaller example and it seems to work fine.