//Assume lp contains the pointer to linked list
struct link_p {
int info;
struct link_p *link;
} lp;
struct link_p *c; //to traverse the list
//Find the first non-matching node in the list
c = lp;
while ((c != null) && (c.info == value) {
c = c->next; // move the pointer ahead
lp = c; // update the list pointer to the first new node
}
// traverse the list from now until the end of list
while (c->next != null) {
if (c->next.info == value) {
// delete the next node
c->next = c->next->next;
c = c->next;
}
}
}