1 2 3
int stacksize (Nodeptrtop) { Nodeptrnp = top; int size = 0; while (np != NULL) {
void printstack (Nodeptrtop) { Nodeptrnp = top; printf ("stack:"); while (np != NULL) {
size++; np = np->next;
printf ("%d ", np->data); 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); printf ("Stack Empty %d\n", pop(&top)); }