My opinion is that:
In the function I wrote, the input always changeds(because of the function nexta), so, theorically, it should be able to remove nodes "in the middle".
This is just my opinion, but it doesn't have much importance because the program is not working.
However, this is how I would write a function to remove nodes which contains a specific value from a linked list (assuming that now all values are int):
Code:void remove_node(struct node **dptr, int n) { while (*dptr != NULL){Code:if ((*dptr)->value != n) *dptr = (*dptr)->next; else{ struct node *temp; temp = *dptr; *dptr = (*dptr)->next; free (temp); } } }
Is that correct in your opinion?