Last change
on this file since 562ccf9 was
1379c96e,
checked in by Peter A. Buhr <pabuhr@…>, 4 months ago
|
formatting changes to programs
|
-
Property mode set to
100644
|
File size:
408 bytes
|
Line | |
---|
1 | #include <sys/queue.h> |
---|
2 | #include <stdio.h> |
---|
3 | |
---|
4 | |
---|
5 | |
---|
6 | int main() { |
---|
7 | |
---|
8 | |
---|
9 | |
---|
10 | |
---|
11 | |
---|
12 | |
---|
13 | |
---|
14 | |
---|
15 | |
---|
16 | |
---|
17 | |
---|
18 | |
---|
19 | |
---|
20 | // C |
---|
21 | |
---|
22 | struct req { |
---|
23 | int pri, rqr; |
---|
24 | LIST_ENTRY(req) d; |
---|
25 | }; |
---|
26 | LIST_HEAD(reql, req); |
---|
27 | |
---|
28 | struct reql reqs; |
---|
29 | LIST_INIT(&reqs); |
---|
30 | |
---|
31 | struct req r1 = {1, 42}, r2 = {2, 42}; |
---|
32 | |
---|
33 | LIST_INSERT_HEAD(&reqs, &r2, d); |
---|
34 | LIST_INSERT_HEAD(&reqs, &r1, d); |
---|
35 | |
---|
36 | |
---|
37 | |
---|
38 | |
---|
39 | |
---|
40 | |
---|
41 | |
---|
42 | |
---|
43 | |
---|
44 | |
---|
45 | |
---|
46 | struct req *cur; |
---|
47 | LIST_FOREACH(cur, &reqs, d) |
---|
48 | printf("{%d %d} ", cur->pri, cur->rqr); |
---|
49 | printf("\n"); |
---|
50 | |
---|
51 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.