struct Node {
int Data;
struct Node* Next;
};
struct QNode {
struct Node* rear;
struct Node* front;
};
typedef struct QNode* Queue;
Queue PtrQ;
//出队
int DeleteQ(Queue PtrQ)
{
struct Node* FrontCell;
int FrontElem;
if (PtrQ->front == NULL)
{
printf("队列空");
return NULL;
}
FrontCell = PtrQ->front;
if (PtrQ->front == PtrQ->rear)
PtrQ->front = PtrQ->rear = NULL;
else
PtrQ->front = PtrQ->front->Next;
FrontElem = FrontCell->Data;
free(FrontCell);
return FrontElem;
}
队列的链式存储实现
最新推荐文章于 2022-01-17 23:13:41 发布