diff options
| author | Tyge Løvset <[email protected]> | 2023-02-08 16:16:49 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-02-08 17:18:24 +0100 |
| commit | c4441f5fc665194fbd7a894a67a64a08c3beac42 (patch) | |
| tree | 82f231b6e8fcb75625166f98aa785baaa265a3d6 /misc/examples/lower_bound.c | |
| parent | 673dd5319a488d4b702b94dd9aeda4e497ae4fbc (diff) | |
| download | STC-modified-c4441f5fc665194fbd7a894a67a64a08c3beac42.tar.gz STC-modified-c4441f5fc665194fbd7a894a67a64a08c3beac42.zip | |
Changed to use lowercase flow-control macros in examples (uppercase will still be supported). Improved many examples to use c_make() to init containers.
Diffstat (limited to 'misc/examples/lower_bound.c')
| -rw-r--r-- | misc/examples/lower_bound.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/misc/examples/lower_bound.c b/misc/examples/lower_bound.c index 8d048e7c..f492ccaa 100644 --- a/misc/examples/lower_bound.c +++ b/misc/examples/lower_bound.c @@ -9,12 +9,10 @@ int main() { // TEST SORTED VECTOR - c_AUTO (cvec_int, vec) + c_auto (cvec_int, vec) { int key, *res; - - c_FORLIST (i, int, {40, 600, 1, 7000, 2, 500, 30}) - cvec_int_push(&vec, *i.ref); + vec = c_make(cvec_int, {40, 600, 1, 7000, 2, 500, 30}); cvec_int_sort(&vec); @@ -33,19 +31,17 @@ int main() if (it2.ref) printf("Sorted Vec %d: bin. search: %d\n", key, *it2.ref); // 600 - c_FOREACH (i, cvec_int, it1, it2) + c_foreach (i, cvec_int, it1, it2) printf(" %d\n", *i.ref); puts(""); } // TEST SORTED SET - c_AUTO (csset_int, set) + c_auto (csset_int, set) { int key, *res; - - c_FORLIST (i, int, {40, 600, 1, 7000, 2, 500, 30}) - csset_int_push(&set, *i.ref); + set = c_make(csset_int, {40, 600, 1, 7000, 2, 500, 30}); key = 100; res = csset_int_lower_bound(&set, key).ref; @@ -62,7 +58,7 @@ int main() if (it2.ref) printf("Sorted Set %d: find : %d\n", key, *it2.ref); // 600 - c_FOREACH (i, csset_int, it1, it2) + c_foreach (i, csset_int, it1, it2) printf(" %d\n", *i.ref); } } |
