faizu stack operation experiment
faizu stack operation experiment
Roll No. : 49
Program :
#include<stdio.h>
int stack[100],choice,n,top,x,i;
void push(void);
void pop(void);
void display(void);
int main()
top=-1;
scanf("%d",&n);
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)
printf("\n%d",stack[i]);
else
{
Output :