Your code is messy.
Try:
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
struct node;
void add(int val);
void display();
void pop();
struct node
{
int data;
struct node *next; } *front=NULL;
int main()
{
add(56);
add(88);
add(44);
add(99);
add(100);
add(23);
display();
pop();
pop();
printf("after 2 pops\n");
display();
while (front) pop();
getchar();
return 0;
}
void add(int val)
{
struct node * temp = (struct node *)malloc(sizeof(struct node));
assert(temp);
temp->data = val;
temp->next = NULL;
if ( ! front )
{
front = temp;
}
else
{
struct node * p = front;
while ( p->next )
{
p = p->next;
}
p->next = temp;
}
}
void display()
{
int count=0;
struct node * temp = front;
while(temp)
{
printf("%d\n", temp->data);
count++;
temp = temp->next;
}
printf("No of Nodes: %d\n",count);
}
void pop()
{
struct node *temp;
temp = front;
if ( temp )
{
front = temp->next;
printf("\nDeleting node value: %d\n", temp->data);
free(temp);
}
else
{
printf("\nEmpty queue\n");
}
}