struct Node { int val; Node * next; }; void deleteNode(Node ** head, Node * target) { assert(head != NULL && *head != NULL && target != NULL); //头结点的判断 if(*head == target) { *head = target->next; delete target; } //尾节点的判断 if(target->next == NULL){ Node *p = *head; while(*p ->next != head) p = p->next; p->next = NULL; delete target ; }else{ Node *p = target-next; target->val = p->val; target->next = p->next; delete p; } }