Following is the function used for traverse the stack which is implement by linked list.
void traverse() { struct stack *ptr=top; printf("Stack is :\n"); while(ptr!=NULL) { printf("%d ",ptr->data); ptr=ptr->back; }