blob: 9147e3f22754b5aa44ec733ec1b705eac2c478ce (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
#include <stdio.h>
struct Point { int x, y; } typedef Point;
#define i_type PointQ
#define i_val Point
#define i_less(a, b) a->x < b->x || (a->x == b->x && a->y < b->y)
#include <stc/cpque.h>
int main()
{
PointQ pque = c_make(PointQ, {{23, 80}, {12, 32}, {54, 74}, {12, 62}});
// print
for (; !PointQ_empty(&pque); PointQ_pop(&pque))
{
const Point *v = PointQ_top(&pque);
printf(" (%d,%d)", v->x, v->y);
}
puts("");
PointQ_drop(&pque);
}
|