A queue like a stack is another special type of ordered list. In queue insertion operations are permitted at one end of the list and deletion operations are performed at the other end of the list. The end where insertion operations are performed is called rear and the end where deletion operations are performed is called front. A queue is often called Fisrt In Fisrt Out(FIFO) list because the first element removed is the first element added to the queue.

Here we will see the operations on stack using linked list because the stack is never full as long as the system has enough space for dynamic memory allocation.

A queue can defined by following structure:

```typedef struct element {
int item;
struct element *next;
} element;

typedef struct queue {
element *front;
element *rear;
} queue;```

If queue variable is `q` then `q->front` points to the front extreme end and `q->rear` points to the rear extreme end of the queue.

The complete source code is given below

```/*
* File:   Queue.c
* Author: https://www.roytuts.com
*/

#include <stdio.h>
#include <stdlib.h>

typedef struct element {
int item;
struct element *next;
} element;

typedef struct queue {
element *front;
element *rear;
} queue;

void add(int item, queue *q) {
element *e;
e = (element*) malloc(sizeof (element));
e->item = item;
e->next = NULL;
if (q->front == NULL) {
q->front = e;
q->rear = e;
return;
}
q->rear->next = e;
q->rear = e;
}

int delete(queue *q) {
element *e;
if (q->front == NULL) {
printf("\nQueue is empty\n");
return 0;
}
e = q->front;
q->front = q->front->next;
if (q->rear == e) {
q->rear = NULL;
}
free(e);
return 1;
}

void display(queue *q) {
element *t;
if (q->front == NULL) {
printf("\nQueue is Empty\n");
} else {
printf("\n");
t = q->front;
while (t->next != NULL) {
printf("%d->", t->item);
t = t->next;
}
printf("%d->NULL\n", t->item);
}
}

int main() {
int choice, value;
queue *q = (queue*) malloc(sizeof (queue));
q->front = q->rear = NULL;
printf("\n:: Queue using Linked List ::\n");
while (1) {
scanf("%d", &choice);
switch (choice) {
case 1: printf("Enter the value to be added: ");
scanf("%d", &value);
break;
case 2: delete(q);
break;
case 3: display(q);
break;
case 4: exit(0);
default: printf("\nWrong selection!!! Please try again!!!\n");
}
}
}```

The output

```:: Queue using Linked List ::

2. Delete
3. Display
4. Exit
Enter the value to be added: 1

2. Delete
3. Display
4. Exit

1->NULL

2. Delete
3. Display
4. Exit
Enter the value to be added: 2

2. Delete
3. Display
4. Exit

1->2->NULL

2. Delete
3. Display
4. Exit
Enter the value to be added: 3

2. Delete
3. Display
4. Exit

1->2->3->NULL

2. Delete
3. Display
4. Exit
Enter the value to be added: 4

2. Delete
3. Display
4. Exit

1->2->3->4->NULL

2. Delete
3. Display
4. Exit

2. Delete
3. Display
4. Exit

2->3->4->NULL

2. Delete
3. Display
4. Exit
Enter the value to be added: 5

2. Delete
3. Display
4. Exit

2->3->4->5->NULL

2. Delete
3. Display
4. Exit

2. Delete
3. Display
4. Exit

3->4->5->NULL

2. Delete
3. Display
4. Exit
Enter the value to be added: 6

2. Delete
3. Display
4. Exit

3->4->5->6->NULL