diff options
| author | Tyge Løvset <[email protected]> | 2020-07-24 13:07:33 +0200 |
|---|---|---|
| committer | Tyge Løvset <[email protected]> | 2020-07-24 13:07:33 +0200 |
| commit | 54e135b6453fed2cd210bd9b738eb69fdde93a88 (patch) | |
| tree | a9a30c72b5de09ce6cee644c712365446f439e58 /examples/list.c | |
| parent | eda4377e0bea66d23f584b7660a7617f8bea4bf0 (diff) | |
| download | STC-modified-54e135b6453fed2cd210bd9b738eb69fdde93a88.tar.gz STC-modified-54e135b6453fed2cd210bd9b738eb69fdde93a88.zip | |
Added <container>_<tag>_init variables; Fixed prime.c and list.c examples.
Diffstat (limited to 'examples/list.c')
| -rw-r--r-- | examples/list.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/examples/list.c b/examples/list.c index 81569260..53b8711f 100644 --- a/examples/list.c +++ b/examples/list.c @@ -5,10 +5,7 @@ declare_CList(ix, uint64_t);
int main() {
- CList_ix list = clist_ix_from((uint64_t[]) {10, 20, 30, 40}, 4);
- c_foreach (i, clist_ix, list) printf("%zu ", i.item->value);
- puts("");
-
+ CList_ix list = clist_init;
crandom32_t pcg = crandom32_init(time(NULL));
int n;
for (int i=0; i<10000000; ++i) // ten million
@@ -22,5 +19,11 @@ int main() { puts("sorted");
c_foreach (i, clist_ix, list)
if (n--) printf("%8d: %10zu\n", 100 - n, i.item->value); else break;
+
+ clist_ix_clear(&list);
+ c_push(&list, clist_ix, c_items(10, 20, 30, 40, 50));
+ c_foreach (i, clist_ix, list) printf("%zu ", i.item->value);
+ puts("");
+
clist_ix_destroy(&list);
}
\ No newline at end of file |
