#include<stdio.h>
#include<stdlib.h>
struct node
{
int info;
struct node *link;
} *front=NULL,*rear=NULL;
void insert(int item)
{
struct node *tmp;
tmp=(struct node*)malloc(sizeof(struct node));
if(tmp==NULL)
{
printf("Memory not avaliable\n");
return ;
}
tmp->info=item;
tmp->link=NULL;
if(front==NULL)
{
front=tmp;
}
else
rear->link=tmp;
rear=tmp;
}
int del()
{
struct node *tmp;
int item;
if(isEmpty())
{
printf("Queue underflow\n");
exit(1);
}
tmp=front;
item=tmp->info;
front=front->link;
free(tmp);
return item;
}
#include<stdlib.h>
struct node
{
int info;
struct node *link;
} *front=NULL,*rear=NULL;
void insert(int item)
{
struct node *tmp;
tmp=(struct node*)malloc(sizeof(struct node));
if(tmp==NULL)
{
printf("Memory not avaliable\n");
return ;
}
tmp->info=item;
tmp->link=NULL;
if(front==NULL)
{
front=tmp;
}
else
rear->link=tmp;
rear=tmp;
}
int del()
{
struct node *tmp;
int item;
if(isEmpty())
{
printf("Queue underflow\n");
exit(1);
}
tmp=front;
item=tmp->info;
front=front->link;
free(tmp);
return item;
}