// Pop Push using link list

# include 
# include 
typedef struct list
{
	int x;
	struct list *next;
}node;
void push(node **,node **);
void pop(node **,node **);
void print(node *);
void main()
{
	char ch,ans='y';
	node *top=NULL,*first=NULL;
	while(ans=='y')
	{
	printf("What do you want to do ? (i = push / d = pop : )");
	scanf(" %c",&ch);
	switch(ch)
	{
		case 'i':
			push(&first,&top);
			print(first);
			break;
		case 'd':
			pop(&first,&top);
			print(first);
	}
	printf("Continue ? ");
	scanf(" %c",&ans);
	}
}
void push(node **first,node **top)
{
	node *temp;
	temp=(node *)malloc(sizeof(node));
	printf("Value of X ---> ");
	scanf(" %d",&temp->x);
	temp->next=NULL;
	if(!(*first))
		(*first)=temp;
	else
		(*top)->next=temp;
	(*top)=temp;
}
void print(node *first)
{
	node *curr=first;
	for(;curr;curr=curr->next)
		printf("%4d",curr->x);
}
void pop(node **first,node **top)
{
	node *curr=(*first);
	for(;curr->next->next;curr=curr->next);
	(*top)=curr;
	(*top)->next=NULL;
}









    Source: geocities.com/alpesh_purohit/projects

               ( geocities.com/alpesh_purohit)