summaryrefslogtreecommitdiffhomepage
path: root/examples/advanced.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/advanced.c
parent0c64199a35a8901a4969f8c2ce0c0483f184732c (diff)
downloadSTC-modified-0b95e794fe91b69928bb111d66fc973d18de7a1f.tar.gz
STC-modified-0b95e794fe91b69928bb111d66fc973d18de7a1f.zip
Updates examples using cfmt.h c_print().
Diffstat (limited to 'examples/advanced.c')
-rw-r--r--examples/advanced.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/examples/advanced.c b/examples/advanced.c
index e9e0002b..83155405 100644
--- a/examples/advanced.c
+++ b/examples/advanced.c
@@ -10,9 +10,8 @@
* In order to use Viking as a map key, it is smart to define a plain-old-data "view"
* of the Viking struct, to simplfy insert and lookup in the map.
*/
-#include <stdio.h>
#include <stc/cmap.h>
-#include <stc/cstr.h>
+#include <stc/cfmt.h>
// Viking data struct -----------------------
@@ -74,7 +73,7 @@ int main()
cmap_vk_emplace(&vikings, einar, 0).first->second += 5; // again
c_foreach (k, cmap_vk, vikings) {
- printf("%s of %s has %d hp\n", k.val->first.name.str, k.val->first.country.str, k.val->second);
+ c_print(1, "{} of {} has {} HP\n", k.val->first.name.str, k.val->first.country.str, k.val->second);
}
cmap_vk_del(&vikings);
}