这个题那里错了
#include<stdio.h>
#include<stdlib.h>
#define Maxsize 20
typedef struct LQNode
{int data;
struct LQNode *next;
}LqueueNode;
typedef struct
{
int data[Maxsize];
int *rear;
int *front;
}LinkQueue;
int
EnLQueue(LinkQueue *Q,int x)
{LqueueNode *p;
if((p=(LqueueNode*)malloc(sizeof(LqueueNode)))==NULL) return 0;
p->data=x;p->next=NULL;
if(Q->rear!=NULL)
Q->rear->next=p;
Q->rear=p;
if(Q->front==NULL) Q->front=p;
return
1;
}
int DeLQueue(LinkQueue *Q,int *x)
{LqueueNode
*p;
if (Q->front==NULL)
{printf("\nError:the queue is empty!\n");
return 0;
}
*x=Q->front->data;
p=Q->front;
Q->front=Q->front->next;
if(Q->front==NULL)
Q->rear=NULL;
free(p);
return
1;
}
main()
{char ch;
int x;
LinkQueue *Q;
int EnQueue(LinkQueue *Q,int x);
int DeLQueue(LinkQueue *Q,int *x);
printf("\nqing shu ru cha ru wei zhi :\n");
scanf("%d" ,&x);
EnLQueue(Q,x);
printf("\nDO YOU WANT TO CONTINUE(Y/N)?");
getchar();
ch=getchar();
printf("\nDO YOU WANT TO DELETE THE DATA FROM QUEUE(Y/N)?");
getchar();
ch=getchar();
while(ch=='Y')
{ DeLQueue(Q,&x);
printf("\nTHE DATA DELETED FROM QUEUE IS :%d",x);
printf("\nDO YOU WANT TO CONTNUE (Y/N)?");
getchar();
ch=getchar();
}
}