Here is the program to implement Queue using two Stacks
#include
#define max 5 // size of the Stack
struct stack
{
int top,a[max];
};
int push(struct stack *p1,int n)
{
if(p1->top==max-1) // Condition for checking If Stack is Full
{
printf("stack overflow\n");
return 0;
}
p1->top++; //increment
↧