Program: Program segment for insertion of an element into the queue
add(int value)
{
struct queue *new;
new = (struct queue*)malloc(sizeof(queue));
new->value = value; new->next = NULL;
if (front == NULL)
{
queueptr = new;
front = rear = queueptr
}
else
{
rear->next = new;
rear=new;
}
}