#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
struct node
{
int info;
struct node*next;
};
struct queue
{
struct node*rear;
struct node *front;
};
void main()
{
struct node *node1;
struct queue *queue1;
char ch='y';
queue1=NULL;
while(ch=='y')
{
node1=malloc(sizeof(struct node));
if(queue1==NULL)
{
queue1->front=queue1->rear=node1;
}
else
{
queue1->front=node1;
queue1->front=queue1->front->next;
}
queue1->front->next=NULL;
printf("\n enter any value ") ;
scanf("%d",&node1->info) ;
printf("\n do you want to more press your choice(Y/N) :") ;
fflush(stdin);
scanf("%c",&ch);
}
for( ;queue1->front!=NULL;queue1->front=queue1->front->next)
{
printf("%d",queue1->front->info);
}
getch();
}
0 comments:
Post a Comment