include<stdio.h>
#include<conio.h>
void push();
void pop();
void disp();
int stack[10],top=-1;
void main()
int ch;
{
while(1)
{
clrscr();
printf("\n1.push \n2.pop \n3.dispaly \n4.exit");
printf("enter your choice");
scanf("%d"&ch);
switch(ch)
{
case 1: push();
break;
case 2: pop();
break;
case 3: disp();
brak;
case 4:
exit(0)
}
getch()
}
}
void push()
{
if(top==9)
printf("\n stack is full");
else
{
printf("enter the data");
scanf("%d",&d);
top=top+1;
stack[top]=d;
}
}
void pop()
{
if(top==-1)
printf("\n stack is empty");
else
printf("\n poped item is %d ", stack[top]);
top=top-1;
}
void disp()
{
if(top==-1)
printf("\n stack is empty");
else
for(i=top;i>0;i--)
printf("%d",stack[i]);
}
ERROR: line 8 : declaration syntax error
line 9: declaration terminated incorrectly
Tags: