TP_9 exo1: split the linked list implementation into reusable code
[TD_C.git] / TP_9 / exo1 / clist.h
diff --git a/TP_9/exo1/clist.h b/TP_9/exo1/clist.h
new file mode 100644 (file)
index 0000000..02a59be
--- /dev/null
@@ -0,0 +1,16 @@
+#ifndef CLIST_H
+#define CLIST_H
+
+/** Linked list of int */
+typedef struct link_s {
+    int value;
+    struct link_s* next;
+} link_t;
+
+link_t* list_new(int value); 
+void list_append(link_t* head, int value); 
+unsigned list_count(link_t* head);
+int list_get(link_t* head, unsigned index);
+void list_clear(link_t* link);
+
+#endif /* CLIST_H */