forked from keysangyonthan/SPOJsolvent
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqueue.cpp
More file actions
57 lines (44 loc) · 610 Bytes
/
Copy pathqueue.cpp
File metadata and controls
57 lines (44 loc) · 610 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include<stdio.h>
#include<stdlib.h>
struct node
{
int value;
struct node *next;
}*new,*front,*rear*temp;
int main()
{
int i,value;
for(i=0;i<5;i++)
{
enqueue();
}
temp=front;
for(i=0;i<5;i++)
{
printf("%d",temp->data);
temp= temp->next;
}
}
enqueue()
{
new = (struct node *) malloc(size of(struct node))
printf("enter elements");
scanf("%d",&value);
new->data = value;
new->next = NULL;
if(front==NULL)
{
front = new;
rear = new ;
}
else
{
rear->next = new;
rear = new;
}
dequeue()
{
temp = front;
front = front->next;
temp->next = NULL;
}