/********************************************************************
created: 2005/12/25
created: 25:12:2005 9:41
filename: queue.h
author: Liu Qi, ngaut#126.com
purpose: 链队列的定义与实现
*********************************************************************/
#ifndef QUEUE_H
#define QUEUE_H
#include <stdio.h>
#include <malloc.h>
#include <assert.h>
typedef int ElemType;
typedef struct
{
ElemType Element;
struct Node* Next;
} Node;
typedef Node* PNode;
typedef struct
{
PNode front;
PNode rear;
} Queue;
/*===========================================================================
* Function name: MakeNode
* Parameter: target:元素的值
* Precondition: void
* Description: 构造一个节点,其值为target,Next为NULL
* Return value: 指向新节点的指针
* Author: Liu Qi, [12/25/2005]
===========================================================================*/
static PNode MakeNode(ElemType target)
{
PNode PNewNode = (PNode) malloc(sizeof(Node));
assert( NULL != PNewNode );
PNewNode->Element = target;
PNewNode->Next = NULL;
return PNewNode;
}
/*==================================================================
链队列头文件“queue.h”(转)
最新推荐文章于 2024-02-27 22:42:19 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)