#include<stdio.h>
#include<stdlib.h>
typedef struct QNOde{
int data;
struct QNOde *next;
}QNode,*QueueList;
void EnQueue(QueueList *head,QueueList *tail,int value);
void Print(QueueList head);
int main()
{
QueueList head=NULL,tail=NULL;
int i,n,value;
printf("Please input node n: ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d",&value);
EnQueue(&head,&tail,value);
}
Print(headPtr);
return 0;
}
void EnQueue(QueueList *head,QueueList *tail,int value)
{
QueueList new;
if((new=(QueueList)malloc(sizeof(QNode)))==NULL)
{
exit(1);
}
newPtr->data=value;
newPtr->next=NULL;
if(*head==NULL)
{
new->next=*head;
*head=new;
}
else
(*tail)->next=new;
*tail=new;
}
void Print(QueueList head)
{
while(head)
{
printf("%d->",head->data);
head=head->next;
}
printf("null\n\n");
}