1
我不知道爲什麼即時獲取此段錯誤在這裏。我正在嘗試將其他節點放在新列表中。 編輯:這是我結束了,但我仍然得到一個segfaultSegfault鏈接列表操作
template <class T>
List<T> List<T>::mixSplit()
{
List<T> newList;
newList.length=0;
for (int count=0;count<2;count++)
newList.head=newList.head->next;
newList.tail=tail;
newList.head->prev=NULL;
newList.tail->next=NULL;
return newList;
}
歡迎來到Stack Overflow。請記住提出所有有用的答案,包括對其他人提出的問題。並記住要「檢查」(接受)最能回答你自己問題的答案。 –
這是幹什麼用的? 'for(int count = 0; count <1; count ++)' – Dani
這裏有很多額外的問題,代碼根本就沒有做你想做的事情。例如,該循環只運行一次,所以它不需要在那裏。 – darvids0n