diff options
| author | Tyge Løvset <[email protected]> | 2023-02-20 14:44:25 +0100 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2023-02-20 14:44:25 +0100 |
| commit | a8fc8ac4e8c1481300e0d46bbd376f32ebeb4635 (patch) | |
| tree | 68dad18a7cf235916b5a1a2257bb80e69bb5d23e /misc/examples/list.c | |
| parent | 0e3d07dbd991c1f1a691b24655c37ddab660a9d9 (diff) | |
| download | STC-modified-a8fc8ac4e8c1481300e0d46bbd376f32ebeb4635.tar.gz STC-modified-a8fc8ac4e8c1481300e0d46bbd376f32ebeb4635.zip | |
Added c_eraseremove_if() for cvec, cdeq, cstack, cqueue in ccommon.h. Some cleanup.
Diffstat (limited to 'misc/examples/list.c')
| -rw-r--r-- | misc/examples/list.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/misc/examples/list.c b/misc/examples/list.c index 6a655800..b345bd16 100644 --- a/misc/examples/list.c +++ b/misc/examples/list.c @@ -17,6 +17,7 @@ int main() { int m = 0; c_forrange (n) clist_fx_push_back(&list, stc64_uniformf(&rng, &dist)), ++m; + double sum = 0.0; printf("sumarize %d:\n", m); c_foreach (i, clist_fx, list) @@ -46,18 +47,21 @@ int main() { const double* v = clist_fx_get(&list, 30); printf("found: %f\n", *v); - c_foreach (i, clist_fx, list) printf(" %g", *i.ref); + c_foreach (i, clist_fx, list) + printf(" %g", *i.ref); puts(""); clist_fx_remove(&list, 30); clist_fx_insert_at(&list, clist_fx_begin(&list), 5); // same as push_front() clist_fx_push_back(&list, 500); clist_fx_push_front(&list, 1964); - clist_fx_iter it = clist_fx_begin(&list); + printf("Full: "); c_foreach (i, clist_fx, list) printf(" %g", *i.ref); + printf("\nSubs: "); + clist_fx_iter it = clist_fx_begin(&list); c_foreach (i, clist_fx, clist_fx_advance(it, 4), clist_fx_end(&list)) printf(" %g", *i.ref); puts(""); |
