#include<stdio.h>
#include<string.h>
#define STACKSIZE 5
void PUSH (struct *ps,int x);
int empty (struct stack *ps);
int POP (struct stack *ps);
int stacktop(struct stack *ps, int x);



struct stack 
{
	int top;
	int items[STACKSIZE];
};



main()

{
	struct stack s;
	int ch,x;
	printf("/t /t Stack Lab /n");
	printf("1:PUSH\n2:POP\n3:Display\n4:Quit\n");
	printf("Please Enter your Choice:\t");
	scanf("%d",&ch);
	printf("\n");
	do
	{
		switch(ch)
			{
		case 1:
			{
				PUSH(&s,x);
			}
			break;
		case 2:
			{
				int x;
				x=POP(&s);
			}
			break;
		//case 3:
		//	{
		//	}
		//	break;
		case 4:
				printf("***Exit***\n");
			break;
		}
		printf("****************************\n");
	}
	while(ch<5);
	return 0;
}


void PUSH (struct *ps,int x)
{
	if(ps->top==STACKSIZE-1)
	{
		printf("stack overflow");
	}
	else 
		ps->items[++(ps->top)]=x;
	return ;
}


int POP(struct stack *ps)
{
	if(empty(ps))
	{
		printf("stack underflow");
	}
	else
		return (ps ->items[ps->top--]);
}


int empty (struct stack *ps)
{
	if (ps->top==-1)
		return true ;
	else
		return false;
}

int stacktop(struct stack *ps, int x)
{
	if(empty(ps))
	{
		printf("stack underflow");
	}
	else
		return (ps->items[ps->top]);
}
