void LinkDestroy(LinkList*& L) { //定义临时节点p指向头节点 LinkList* p = L; cout << "销毁链表!" << endl; while (p) { L = L->next; cout << "删除元素:" << p->data << endl; delete p; p = L; } }
void LinkDestroy(LinkList*& L) { //定义临时节点p指向头节点 LinkList* p = L; cout << "销毁链表!" << endl; while (p) { L = L->next; cout << "删除元素:" << p->data << endl; delete p; p = L; } }