1 2 3

int stacksize (Nodeptrtop)void printstack (Nodeptrtop) {{
Nodeptrnp = top;Nodeptrnp = top;
int size = 0;printf ("stack:");
while (np != NULL) {while (np != NULL) {
size++;printf ("%d ", np->data);
np = np->next;np = np->next;
}}
return size;printf("\n"); }}
void main (void) {
Nodeptrtop = NULL;
int item;
while (scanf ("%d", &item) != EOF) {
if (push (item, &top) == STACKFULL) break;
}
printstack (top);
printf ("Stack size is %d\n", stacksize (top));
clearstack (&top);
if (pop(&top) == STACKEMPTY) printf ("Stack Empty\n"); }