链式队列创建

#ifndef __LINKQUEUE_H__
#define __LINKQUEUE_H__



#define TRUE  1
#define FALSE 0


typedef int QueueData;
typedef struct _node
{
QueueData data;
struct _node *next;
}Node;


typedef struct _queue
{
Node *front;
Node *rear;

}Queue;

Queue* Create_Queue()
{
Queue * q = (Queue*)malloc(sizeof(Queue)/sizeof(char));
if (q == NULL)
{
errno = MALLOC_ERROR;
return NULL;
}

// 置空队
q->front = NULL;
q->rear  = NULL;

return q;
}

猜你喜欢

转载自blog.csdn.net/inconceivableccx/article/details/76799601