我定义了一个链表,和一个node类,里面只有一个整形数据date,和一个指针node指针,运行代码时出现了死循环

bool List:: ListInsertHead(Node *pNode )
{	
	Node *temp = m_pList->next;	//m_pList是在链表里的一个Node指针
	m_pList->next = NULL;
	ListInsertTail(pNode);
	ListInsertTail(temp);
	m_iLenth++;
	return true;
}

bool List::ListInsertTail(Node *pNode)
{
	Node *currentNode = m_pList;
	while (currentNode ->next!=NULL ) {
		currentNode = currentNode->next;
	}
	ListSetNull(pNode);
	currentNode->next = pNode;
	m_iLenth++;
	return true;
}

bool List::ListSetNull(Node *pNode)
{
	Node *currentNode = pNode;
	while (currentNode->next != NULL) {
		currentNode = currentNode->next;
	}
	currentNode->next = NULL;
	return true;

}


C10H16N5O13P3
浏览 1357回答 0
0回答
打开App,查看更多内容
随时随地看视频慕课网APP