summaryrefslogtreecommitdiffhomepage
path: root/examples/stack.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2020-09-20 00:08:42 +0200
committerTyge Løvset <[email protected]>2020-09-20 00:08:42 +0200
commit7d124bea3cc2d999f98acb2b9ee0f828a19c4e4f (patch)
treeec6cee64f415d2ef5eb6bfb3e0ee972e2477251c /examples/stack.c
parent404f7ea40aa7f3a6d6c3713a6e517a51f19558b7 (diff)
downloadSTC-modified-7d124bea3cc2d999f98acb2b9ee0f828a19c4e4f.tar.gz
STC-modified-7d124bea3cc2d999f98acb2b9ee0f828a19c4e4f.zip
converted to c_forrange().
Diffstat (limited to 'examples/stack.c')
-rw-r--r--examples/stack.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/examples/stack.c b/examples/stack.c
index a911e4a2..68519a9b 100644
--- a/examples/stack.c
+++ b/examples/stack.c
@@ -12,13 +12,16 @@ int main() {
cstack_i stack = cstack_i_init();
cstack_c chars = cstack_c_init();
- c_forrange (i, int, 100)
+ 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\n", *cstack_i_itval(i));
+ printf(" %d", *i.get);
+ puts("");
printf("top: %d\n", *cstack_i_top(&stack));
} \ No newline at end of file