The problem is as follows
Input: Pointer to node C in list A->b->c->d->e
Output: no return value, but new list becomes a->b->d->e
Answer:
Thought for a long time did not think out, read the hint to know the solution. Here's a little trick. To remove the intermediate node, but we do not know to delete the node's last node p, so we can not modify the pointer method (P->next=del->next) to delete the node, but know to delete the node after the node, then we change the idea, The data of the node to be deleted is exchanged with that of the node, and then the latter node is deleted, thus achieving the goal. However, the method cannot delete the last node, for obvious reasons.
Copy Code code as follows:
A tricky solution,can ' t delete the last one element
int Delete_node (node* node) {
int data;
NODE *p=node->next;
node->data=p->data;
node->next=p->next;
Free (p);
}