summaryrefslogtreecommitdiffhomepage
path: root/examples/stack.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2020-10-26 20:25:03 +0100
committerTyge Løvset <[email protected]>2020-10-26 20:25:03 +0100
commit0b95e794fe91b69928bb111d66fc973d18de7a1f (patch)
tree35843d6e5f17e07a3cbb3f8b59df4965661a35d8 /examples/stack.c
parent0c64199a35a8901a4969f8c2ce0c0483f184732c (diff)
downloadSTC-modified-0b95e794fe91b69928bb111d66fc973d18de7a1f.tar.gz
STC-modified-0b95e794fe91b69928bb111d66fc973d18de7a1f.zip
Updates examples using cfmt.h c_print().
Diffstat (limited to 'examples/stack.c')
-rw-r--r--examples/stack.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/examples/stack.c b/examples/stack.c
index f65b9243..428f99a0 100644
--- a/examples/stack.c
+++ b/examples/stack.c
@@ -1,5 +1,5 @@
-#include <stdio.h>
+#include <stc/cfmt.h>
#include <stc/cstr.h>
#include <stc/cstack.h>
@@ -12,16 +12,16 @@ int main() {
cstack_i stack = cstack_i_init();
cstack_c chars = cstack_c_init();
- c_forrange (i, int, 101)
+ c_forrange (i, int, 101)
cstack_i_push(&stack, i*i);
- printf("%d\n", *cstack_i_top(&stack));
+ c_print(1, "{}\n", *cstack_i_top(&stack));
- c_forrange (i, int, 90)
+ c_forrange (i, int, 90)
cstack_i_pop(&stack);
-
+
c_foreach (i, cstack_i, stack)
- printf(" %d", *i.val);
+ c_print(1, " {}", *i.val);
puts("");
- printf("top: %d\n", *cstack_i_top(&stack));
+ c_print(1, "top: {}\n", *cstack_i_top(&stack));
} \ No newline at end of file