Experiment 1
Experiment 1
#include <stdio.h>
int main()
top=-1;
scanf("%d",&n);
printf("\n\t-----------------------------");
do
scanf("%d",&choice);
switch(choice)
case 1:
push();
break;
case 2:
pop();
break;
}
case 3:
display();
break;
case 4:
break;
default:
while(choice!=4);
return 0;
void push()
if (top>=n-1)
else
scanf("%d",&x);
top++;
stack [top]=x;
void pop()
if (top<=-1)
else
top--;
void display()
if(top>0)
for(i=top;i>=0;i--)
printf("\n%d",stack[i]);
else
Output:
Enter the size of the STACK [MAX=100]:4
-------------------------------------------------
1.PUSH
2.POP
3.DISPLAY
4.EXIT
EXIT POINT