Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions queue_stack.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@

#include "Linked_Stack.h"
#include<stdlib.h>
#include<stdio.h>
void main()
{
struct node *top1=createstack();
int temp,ch;
do
{
printf("enter the choice 1.push 2.pop 3.exit");
scanf("%d",&ch);
switch(ch)
{
case 1:
printf("enter the element to be pushed");
scanf("%d",&temp);
push(temp,top1);
break;
case 2:
printf("Deleted element is");
node *top2=createstack();
while(1)
{
temp=pop(top1);
if(peek(top1))
push(temp,top2);
else
{
if(temp==0)
printf("empty");
else
printf("%d\n",temp);
break;
}
}
while(1)
{
temp=pop(top2);
if(temp)
push(temp,top1);
else
break;

}
break;
}
}while(ch!=3);


}