1 2 3

int push (int item,Nodeptr*top) {
Nodeptrnp;
np = (
Nodeptr) malloc (sizeof (Node));
if (np == NULL)
return
STACKFULL;
else {
np->data = item;
np->next = *top;
*top = np;
} ;
return
OK;
}

int pop (Nodeptr*top) {
Nodeptrnp;
int item;
if (*top != NULL) {
item = (*top)->data;
np = *top;
*top = (*top)->next;
free (np);
return item;
};
return
STACKEMPTY; }