TP 9 exo2: Add list_insert and list_delete linked list helpers
[TD_C.git] / TP_9 / exo2 / exo2.c
index 15172cee30296de07f8e18242bd7c0bfd30c20f4..ff5912bcb3e685ab74f1206f6f182458dcff6ad7 100644 (file)
@@ -20,6 +20,16 @@ int main() {
     printf("Valeur a index %d: %d\n", 4, list_get(head, 4));
     list_set(head, 0, 78);
     printf("Valeur a index %d: %d\n", 0, list_get(head, 0));
+    printf("Valeur a index %d: %d\n", 1, list_get(head, 1));
+    printf("Valeur a index %d: %d\n", 2, list_get(head, 2));
+    head = list_insert(head, 2, 7);
+    printf("Valeur a index %d: %d\n", 1, list_get(head, 1));
+    printf("Valeur a index %d: %d\n", 2, list_get(head, 2));
+    printf("Valeur a index %d: %d\n", 3, list_get(head, 3));
+    //head = list_delete(head, 2);
+    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;