I am inserting element in queue but an infinite loop is running //x is the element to be entered
void enqueue(int x)
{
queue *ptr;
ptr=(queue*)malloc(sizeof(queue));
ptr->info=x;
if(front==NULL&&rear==NULL)
{
front=rear=ptr;
ptr->next=NULL;
}
else
{
rear->next=ptr;
rear=ptr;
}
}
//Show function to print the elements
void show()
{
queue *ptr=front;
while(ptr!=NULL)
{
printf("%d\n",ptr->info);
ptr=ptr->next;
}
}