コード例 #1
0
ファイル: queue2.c プロジェクト: Ricky-Hao/C-Primer-Plus-Demo
bool DeQueue(Item *pitem, Queue *pq)
{
	Node *pt;

	if (QueueIsEmpty(pq))
		return false;
	CopyToItem(pq->front, pitem);
	pt = pq->front;
	pq->front = pq->front->next;
	free(pt);
	pq->items--;
	if (pq->items == 0)
		pq->rear = NULL;
	return true;
}
コード例 #2
0
ファイル: 8list.c プロジェクト: 18616378431/myCode
BOOL DeQueue(Item *pItem,Queue * pq)
{
	Qnode * pt;

	if(QueueIsEmpty(pq))
		return FALSE;
	CopyToItem(pq->head,pItem);
	pt = pq->head;//记录头指针
	pq->head = pq->head->next;//将头指针指向下一个节点
	free(pt);//释放记录头指针的变量指向的内存
	pq->items--;
	if(pq->items == 0)
		pq->end = NULL;
	return TRUE;
}