#include <stdio.h>
#include <stdlib.h>
typedef struct node
{
int data;
struct node *next;
}linknode;
typedef struct
{
linknode *front,*rear;
}linkqueue;
void linkqueue_init(linkqueue &s)
{
s.front=NULL;
s.rear=NULL;
}
void linkqueue_push(linkqueue &s,int e)
{
linknode *p=(int *)malloc(sizeof(int));
if(!p) exit(1);
p->data=e;
p->next=NULL;
if(s.rear==NULL)
s.front=s.rear=p;
else
{
s.rear->next=p;
s.rear=p;
}
}
void linkqueue_pop(linkqueue &s,int &e)]
{
linknode *p;
if(s.tront==NULL) return;
p=s.front;
e=*p->data;
s.front=s.front->next;
free(p);
}