node *head, *current, *temp;
current = head;
while(NULL != current){
temp = current;
current = current->next;
}
delete current;
current = temp;
current->next = NULL;
我只是想知道我知道有这样的东西并且有递归,假设已经有一个链表并且我们不知道列表中有多少个节点。
删除我的意思是解除分配。
node *head, *current, *temp;
current = head;
while(NULL != current->next){
temp = current;
current = current->next;
}
if (NULL != current){
delete current;
current = temp;
current->next = NULL;
}