- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.c
More file actions
Latest commit
62 lines (42 loc) · 855 Bytes
/
Copy pathmain.c
File metadata and controls
62 lines (42 loc) · 855 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
58
59
60
#include<stdio.h>
#include<string.h>
#include"queue.h"
typedefstructpayload {
workCBfunc;
void*arg;
}payload_t;
void*work(void*arg)
{
printf("\n Work \n");
return (NULL);
}
void*print(void*data)
{
payload_t*t= (payload_t*)data;
printf("\n Payload : %s", (char*)t->arg);
}
intmain(void)
{
payload_tp1, p2, p3;
queueObj_tq1;
memset(&q1, 0, sizeof(queueObj_t));
p1.func=work;
p1.arg="SUJEET";
p2.func=work;
p2.arg="JOG";
p3.func=work;
p3.arg="SUMEDHA";
qInit(&q1);
qInsert(&q1, &p1);
qInsert(&q1, &p2);
qInsert(&q1, &p3);
printf("\nObj Count : %d", q1.qCount);
printQ(&q1, print);
qInsert(&q1, &p2);
printf("\nBefore Destroy Obj Count : %d", q1.qCount);
printQ(&q1, print);
qDestroy(&q1);
printQ(&q1, print);
printf("\nAfter Destroy Obj Count : %d", q1.qCount);
return (0);
}