blob: 54d5aeed5822f50dd039bd84e558678e409e587b (
plain)
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
|
#include <stdio.h>
#include <stc/cstr.h>
#define i_tag i
#define i_val int
#include <stc/cstack.h>
#define i_tag c
#define i_val char
#include <stc/cstack.h>
int main() {
cstack_i stack = cstack_i_init();
cstack_c chars = cstack_c_init();
c_autodefer (cstack_i_del(&stack), cstack_c_del(&chars))
{
c_forrange (i, int, 101)
cstack_i_push(&stack, i*i);
printf("%d\n", *cstack_i_top(&stack));
c_forrange (i, int, 90)
cstack_i_pop(&stack);
c_foreach (i, cstack_i, stack)
printf(" %d", *i.ref);
puts("");
printf("top: %d\n", *cstack_i_top(&stack));
}
}
|