#include <stdio.h>
#include <stdlib.h>
#define MAX 300000
typedef struct{
    int data;
    struct node * link;
}node;

node* push(int d,node * top){
 static int count =0;
 node *tmp;
 count++;
 if(count > MAX){
  printf("over Flow Error...!!n");
  return top;
 }
 tmp =(node *)malloc(sizeof(node));
 tmp->link = top;
 tmp->data = d;
 return  tmp; 
}
void pl(node *start){
    node *tmp;
    printf("%d n",start->data);
 if(start->link==NULL)return ;
    tmp = start->link;
    while(1){
        printf("%d n",tmp->data);
        if(tmp->link == NULL)break;
        tmp = tmp->link;
    }   
}
int pop(node **top){
 node *tmp = *top;
 if(*top==NULL){
  printf("Under Flow Errorn");
  return -1;
 }
 *top = tmp->link;
 return tmp->data;
}
main(){
    node *top=NULL;
 top = push(323,top);
 top = push(3,top);
 top = push(4,top);
 top = push(23,top);
 printf("%d  <---popped n",pop(&top));
 printf("%d  <---popped n",pop(&top));
 printf("%d  <---popped n",pop(&top));
 printf("%d  <---popped n",pop(&top));
 
 printf("%d  <---popped n",pop(&top));
 printf("%d  <---popped n",pop(&top));

 //pl(top);

   

}