4
4
h>
#include <stdlib.h>
#define SIZE 4
void push();
void pop();
void display();
int main()
{
int choice;
while (1)
scanf("%d", &choice);
switch (choice)
case 1:
push();
break;
case 2:
pop();
break;
case 3:
show();
break;
case 4:
exit(0);
default:
printf("\nInvalid choice!!");
void push()
int x;
if (top == SIZE - 1)
printf("\nOverflow!!");
else
scanf("%d", &x);
top = top + 1;
inp_array[top] = x;
void pop()
if (top == -1)
printf("\nUnderflow!!");
else
{
printf("\nPopped element: %d", inp_array[top]);
top = top - 1;
void display()
if (top == -1)
printf("\nUnderflow!!");
else
printf("%d\n", inp_array[i]);