1 2 3

A linked representation of a stack

#define OK -8888

#define STACKFULL -7777

#define STACKEMPTY -6666


typedef struct node* Nodeptr;

top:

IMAGE imgs/stack.ppt01.gif

typedef struct node {

int data;

Nodeptrnext;

} Node;
/* defining Node to be struct node */


void clearstack (Nodeptr*ptr)
{
while (*ptr != NULL)
printf("%d\n", pop(ptr));
}

[CONVERTED BY MYRMIDON]