summaryrefslogtreecommitdiffhomepage
path: root/misc/examples/lower_bound.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-03-26 00:27:45 +0100
committerTyge Løvset <[email protected]>2023-03-26 00:27:45 +0100
commiteb85069b669e754836b9d4587ba03d3af1a5e975 (patch)
tree45c9a0d3fe40c59a8b33ae8ecd2e7aa78bef6240 /misc/examples/lower_bound.c
parente8be14dfc894eeac859f0287d4d5b4f4745c0585 (diff)
downloadSTC-modified-eb85069b669e754836b9d4587ba03d3af1a5e975.tar.gz
STC-modified-eb85069b669e754836b9d4587ba03d3af1a5e975.zip
development branch for 4.2
Removed uses of c_auto and c_with in documentation examples and code examples. Still using c_defer a few places. Renamed c11/fmt.h to c11/print.h. Some additions in ccommon.h, e.g. c_const_cast(T, x). Improved docs.
Diffstat (limited to 'misc/examples/lower_bound.c')
-rw-r--r--misc/examples/lower_bound.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/misc/examples/lower_bound.c b/misc/examples/lower_bound.c
index f492ccaa..6ec7544c 100644
--- a/misc/examples/lower_bound.c
+++ b/misc/examples/lower_bound.c
@@ -9,10 +9,9 @@
int main()
{
// TEST SORTED VECTOR
- c_auto (cvec_int, vec)
{
int key, *res;
- vec = c_make(cvec_int, {40, 600, 1, 7000, 2, 500, 30});
+ cvec_int vec = c_make(cvec_int, {40, 600, 1, 7000, 2, 500, 30});
cvec_int_sort(&vec);
@@ -35,13 +34,13 @@ int main()
printf(" %d\n", *i.ref);
puts("");
+ cvec_int_drop(&vec);
}
-
+
// TEST SORTED SET
- c_auto (csset_int, set)
{
int key, *res;
- set = c_make(csset_int, {40, 600, 1, 7000, 2, 500, 30});
+ csset_int set = c_make(csset_int, {40, 600, 1, 7000, 2, 500, 30});
key = 100;
res = csset_int_lower_bound(&set, key).ref;
@@ -60,5 +59,7 @@ int main()
c_foreach (i, csset_int, it1, it2)
printf(" %d\n", *i.ref);
+
+ csset_int_drop(&set);
}
}