>Node *nptr;
>entry = nptr->item;
You forgot to allocate memory for the node and you got the assignment backwards:
Code:
typedef struct node{
Stack entry;
struct node *next;
} Node;
Node *MakeNode(StackEntry *item)
{
Node *nptr;
if ( ( nptr = malloc ( sizeof *nptr ) ) != NULL ) {
nptr = item;
return nptr;
}
else
return NULL;
}
[edit]
I may have mistaken your intention, here is another option:
Code:
Node *MakeNode(StackEntry *item)
{
if ( ( item = malloc ( sizeof *item ) ) != NULL )
return item;
else
return NULL;
}
[/edit]
-Prelude