From 432f24319319fe040e142059eb83279c53f90ab8 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Sat, 9 Aug 2025 08:35:03 +0200 Subject: refactor 2 --- simclist-1.5/examples/ex2.c | 38 -------------------------------------- 1 file changed, 38 deletions(-) delete mode 100644 simclist-1.5/examples/ex2.c (limited to 'simclist-1.5/examples/ex2.c') diff --git a/simclist-1.5/examples/ex2.c b/simclist-1.5/examples/ex2.c deleted file mode 100644 index 3fc2c5e..0000000 --- a/simclist-1.5/examples/ex2.c +++ /dev/null @@ -1,38 +0,0 @@ -#include - -#include - -int main() { - int val; - list_t l; - - list_init(&l); - - /* request to store copies, and provide the metric function */ - list_attributes_copy(&l, list_meter_int32_t, 1); - - printf("Give numbers. Terminate with one negative.\n"); - scanf("%d", &val); - while (val > 0) { - list_append(&l, &val); - scanf("%d", &val); - } - - /* setting the comparator, so the list can sort, find the min, max etc */ - list_attributes_comparator(&l, list_comparator_int32_t); - list_sort(&l, -1); /* sorting the list in descending (-1) order */ - - /* printing out the result */ - printf("Sorted values:\n"); - - list_iterator_start(&l); /* starting an iteration "session" */ - while (list_iterator_hasnext(&l)) { /* tell whether more values available */ - printf("%d\n", *(int *)list_iterator_next(&l)); /* get the next value */ - } - list_iterator_stop(&l); /* starting the iteration "session" */ - - list_destroy(&l); - - return 0; -} - -- cgit v1.2.3-70-g09d2