Implementation of the queue chain Storage Structure 1 -- create and destroy to determine whether the queue is full or empty
// Filename: list_queue.c // Author: LupingChen/Data: 2015.05.30 // Content: create \ destory \ full \ empty \ push # include <stadio. h> # include <stdlib. h> // define the Node data type typedef struct Node {int data; // data struct Node * next; // record the next Node address} Node; // define the Queue data type typedef struct {Node * head; // header pointer} Queue; // determine whether the Queue is full int full (Queue * pq ); // determine whether the Queue is empty int empty (Queue * pq); // enter the Queue void push (Queue * pq, data); // traverse void travel (Queue * pq); I Nt main () {// create, the system destroys the Queue queue; queue. head = NULL; return 0;} // determines whether the Queue is full int full (Queue * pq) {return 0 ;} // determine whether the Queue is empty int empty (Queue * pq) {return NULL = pq-> head;} // Queue void push (Queue * pq, data) {// create Node * pn = (Node *) malloc (sizeof (Node); pn-> data = data; pn-> next = NULL; // mount the Node // empty queue Mount if (empty) {pq-> head = pn;} // non-empty queue Mount Node * p = pq-> head; while (p-> next! = NULL) {p = p-> next;} p-> next = pn;} // traverse void travel (Queue * pq) {printf ("Queue metadata: "); Node * p = pq-> head; while (p! = NULL) {printf ("% d", p-> data); p = p-> next;} printf ("\ n ");}