大佬,单向链表的销毁链表是不是有问题啊
int main()
{
int N = 10;
Lnode* L;
cout << "temp" << endl;
InitList(L);
cout << L << endl;
// CreateListHead(L, 3);
CreateListTail(L, 3);
cout << L->next->data << endl;
// cout << L->next + 1<< endl;
// cout << L->next->data<< endl;
cout << IsEmpty(L) << endl;
DestroyList(L);
cout << IsEmpty(L) << endl;
}
执行的时候,到 DestroyList(L); 的时候直接core dump退出了
大佬,单向链表的销毁链表是不是有问题啊
int main()
{
int N = 10;
Lnode* L;
cout << "temp" << endl;
InitList(L);
cout << L << endl;
// CreateListHead(L, 3);
CreateListTail(L, 3);
cout << L->next->data << endl;
// cout << L->next + 1<< endl;
// cout << L->next->data<< endl;
cout << IsEmpty(L) << endl;
DestroyList(L);
cout << IsEmpty(L) << endl;
}
执行的时候,到 DestroyList(L); 的时候直接core dump退出了