summaryrefslogtreecommitdiffhomepage
path: root/examples/list.c
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2020-12-17 07:55:59 +0100
committerTyge Løvset <[email protected]>2020-12-17 07:55:59 +0100
commitbc2981ee8fa3cba0be0d0efb1e2a2072c98ca5a0 (patch)
tree2e848e43a77cf4507645d7b89231c9a726b3ec05 /examples/list.c
parent214a2aa75d164d285661719131f54c71fa2f8e37 (diff)
downloadSTC-modified-bc2981ee8fa3cba0be0d0efb1e2a2072c98ca5a0.tar.gz
STC-modified-bc2981ee8fa3cba0be0d0efb1e2a2072c98ca5a0.zip
API change: Reverted back to original name used for .val in iterators to .ref
Diffstat (limited to 'examples/list.c')
-rw-r--r--examples/list.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/list.c b/examples/list.c
index a838b3bd..d65da22b 100644
--- a/examples/list.c
+++ b/examples/list.c
@@ -17,24 +17,24 @@ int main() {
double sum = 0.0;
printf("sumarize %d:\n", m);
c_foreach (i, clist_fx, list)
- sum += *i.val;
+ sum += *i.ref;
printf("sum %f\n\n", sum);
k = 0;
c_foreach (i, clist_fx, list)
- if (++k <= 10) printf("%8d: %10f\n", k, *i.val); else break;
+ if (++k <= 10) printf("%8d: %10f\n", k, *i.ref); else break;
puts("sort");
clist_fx_sort(&list); // mergesort O(n*log n)
puts("sorted");
k = 0;
c_foreach (i, clist_fx, list)
- if (++k <= 10) printf("%8d: %10f\n", k, *i.val); else break;
+ if (++k <= 10) printf("%8d: %10f\n", k, *i.ref); else break;
puts("");
clist_fx_clear(&list);
c_push_items(&list, clist_fx, {10, 20, 30, 40, 30, 50});
- c_foreach (i, clist_fx, list) printf(" %g", *i.val);
+ c_foreach (i, clist_fx, list) printf(" %g", *i.ref);
puts("");
int removed = clist_fx_remove(&list, 30);
@@ -44,11 +44,11 @@ int main() {
clist_fx_iter_t it = clist_fx_before_begin(&list);
printf("Full: ");
c_foreach (i, clist_fx, list)
- printf(" %g", *i.val);
+ printf(" %g", *i.ref);
for (int i=0; i<4; ++i) clist_fx_next(&it);
printf("\nSubs: ");
c_foreach (i, clist_fx, it, clist_fx_end(&list))
- printf(" %g", *i.val);
+ printf(" %g", *i.ref);
puts("");
clist_fx_del(&list);
} \ No newline at end of file