4

    xiaoxiao2021-03-25  67

    

    #include<stdio.h>

    #include<malloc.h>

    #include<stdlib.h>

    typedef int ElemType;

    typedef struct Qnode

    {

        int data;

        struct Qnode *next;

    } Qnode;

    typedef struct

    {

        Qnode *front;

        Qnode *rear;

    } LQueue;

    void Init_LQueue(LQueue &q)

    {

        q.front=q.rear=(Qnode *)malloc(sizeof(Qnode));

        q.front->next=NULL;

    }

    void En_LQueue(LQueue &q,int x)

    {

        Qnode *p;

        p=(Qnode *)malloc(sizeof(Qnode));

        p->data=x;

        p->next=NULL;

        q.rear->next=p;

        q.rear=p;

    }

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

    最新回复(0)