summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2021-01-17 09:53:26 +0100
committerTyge Løvset <[email protected]>2021-01-17 09:53:26 +0100
commit894e19c84518e4c679bc96e4653b95a5c9c0e12f (patch)
treeef9e32376925c47d016b968f381aad42e6eb4804 /examples
parentd07526887f0ef4352ed2dacadfcd2b57713c06f2 (diff)
downloadSTC-modified-894e19c84518e4c679bc96e4653b95a5c9c0e12f.tar.gz
STC-modified-894e19c84518e4c679bc96e4653b95a5c9c0e12f.zip
Fixed code so that it runs in STC_HEADER mode. csmap.h slightly simplified.
Diffstat (limited to 'examples')
-rw-r--r--examples/csmap_ex.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/examples/csmap_ex.c b/examples/csmap_ex.c
index b750aa82..3d66ec2a 100644
--- a/examples/csmap_ex.c
+++ b/examples/csmap_ex.c
@@ -7,6 +7,7 @@
//using_csmap(s, cstr, cstr, cstr_del, cstr_clone, cstr_compare_ref, cstr_del, cstr_clone);
using_csmap(i, int, int);
+using_csset_str();
#include <time.h>
@@ -38,8 +39,17 @@ int main(int argc, char **argv)
c_foreach (i, csmap_i, it, csmap_i_end(&map))
printf("-- %d: %d\n", i.ref->first, i.ref->second);
+ printf("\n%d: %d\n", 500000, *csmap_i_at(&map, 500000));
csmap_i_del(&map);
- puts("done");
+ puts("done\n");
+
+
+ c_init (csset_str, names, {
+ "Hello", "Try this", "Awesome", "Works well", "Greetings"
+ });
+ c_foreach (i, csset_str, names)
+ printf("name: %s\n", i.ref->str);
+
return 0;
}