TP_9 exo1: split the linked list implementation into reusable code
[TD_C.git] / TP_9 / exo1 / exo1.c
diff --git a/TP_9/exo1/exo1.c b/TP_9/exo1/exo1.c
new file mode 100644 (file)
index 0000000..e70d29b
--- /dev/null
@@ -0,0 +1,18 @@
+#include <stdio.h>
+
+#include "clist.h"
+
+int main() {
+    link_t* head = list_new(1);
+    printf("Longueur de la liste: %d\n", list_count(head));
+    list_append(head, 2);
+    list_append(head, 3);
+    list_append(head, 4);
+    printf("Longueur de la liste: %d\n", list_count(head));
+    printf("Valeur a index %d: %d\n", 2, list_get(head, 2));
+    printf("Valeur a index %d: %d\n", 3, list_get(head, 3));
+    printf("Valeur a index %d: %d\n", 4, list_get(head, 4));
+    list_clear(head);
+
+    return 0;
+}