From 432f24319319fe040e142059eb83279c53f90ab8 Mon Sep 17 00:00:00 2001 From: Aldrik Ramaekers Date: Sat, 9 Aug 2025 08:35:03 +0200 Subject: refactor 2 --- libs/simclist-1.5/examples/ex1.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 libs/simclist-1.5/examples/ex1.c (limited to 'libs/simclist-1.5/examples/ex1.c') diff --git a/libs/simclist-1.5/examples/ex1.c b/libs/simclist-1.5/examples/ex1.c new file mode 100644 index 0000000..13c67c3 --- /dev/null +++ b/libs/simclist-1.5/examples/ex1.c @@ -0,0 +1,28 @@ +#include + +#include /* use the SimCList library */ + + +int main() { + list_t mylist; /* declare a list */ + int userval; + + + list_init(& mylist); /* initialize the list */ + + printf("Insert your number: "); + scanf("%d", & userval); + + list_append(& mylist, & userval); /* add an element to the list */ + + printf("The list now holds %u elements.\n", \ + list_size(& mylist)); /* get the size of the list */ + + printf("Your number was: %d\n", \ + * (int*)list_get_at(& mylist, 0)); /* extract the first element of the list */ + + list_destroy(&mylist); + + return 0; +} + -- cgit v1.2.3-70-g09d2