链式队列创建

xiaoxiao2021-02-28  99

#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; }

转载请注明原文地址: https://www.6miu.com/read-70675.html

最新回复(0)