Since no one else is touching this, here's a rewrite. Study the changes carefully, especially those involving pointers.
Code:
#include <stdio.h>
#include <malloc.h>
struct node
{
int info;
struct node *next;
};
typedef struct node Node;
Node *newnode( int value);
void enqueue( Node **fro, Node **rea, Node *tmpe, int *qs);
int main()
{
int value, qsize = 0;
Node *front = NULL, *rear = NULL, *temp;
while (1)
{
scanf( "%d", &value);
if (value == 0) break;
temp = newnode( value);
enqueue( &front, &rear, temp, &qsize);
}
for (temp = front; temp; temp = temp->next)
printf( "%d ", temp->info);
printf( "\n");
system("pause");
}
Node *newnode( int item)
{
Node *tmp;
tmp = (Node*) malloc( sizeof( Node));
tmp->info = item;
tmp->next = NULL;
return tmp;
}
void enqueue( Node **fro, Node **rea, Node *tmpe, int *qs)
{
if (*rea == NULL)
{
*rea = tmpe;
*fro = *rea;
*qs++;
}
else
{
(*rea)->next = tmpe;
*rea = tmpe;
*qs++;
}
}