summaryrefslogtreecommitdiff
path: root/simclist-1.5/examples/ex2.c
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2025-08-09 08:35:03 +0200
committerAldrik Ramaekers <aldrikboy@gmail.com>2025-08-09 08:35:03 +0200
commit432f24319319fe040e142059eb83279c53f90ab8 (patch)
tree5631eb0eb3a46d086070e8398d9080ff681133ac /simclist-1.5/examples/ex2.c
parent5d34aff5888d3f0c624251f15bedb96c347978d6 (diff)
refactor 2
Diffstat (limited to 'simclist-1.5/examples/ex2.c')
-rw-r--r--simclist-1.5/examples/ex2.c38
1 files changed, 0 insertions, 38 deletions
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 <stdio.h>
-
-#include <simclist.h>
-
-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;
-}
-