STACK AND ITS APPLICATION
This program reverses a set of numbers using stacks.Arrays are not used.
#include"stdio.h"
int *p;
main()
{
int a,b,c,n,count=0;
clrscr();
p=malloc(20*sizeof(int));
printf("how many elements do you want to enter:");
scanf("%d",&n);
printf("enter the numbers");
while(count
{
scanf("%d",&a);
in(a);
count++;
}
while(count>0)
{
b=out();
printf("%d ",b);
count--;
}
getch();
}
in(int x)
{
*p=x;
p++;
}
out()
{
p--;
return *p;
}