summaryrefslogtreecommitdiffstats
path: root/linked_list.h
diff options
context:
space:
mode:
authorGustav Sörnäs <gustav@sornas.net>2021-01-26 14:22:46 +0100
committerGustav Sörnäs <gustav@sornas.net>2021-01-26 14:22:55 +0100
commit38866c562ee404eb52a536785a5e7fafe7951185 (patch)
tree54b87c7c13073e6ce340c222935fc5eeb17fafbc /linked_list.h
downloadlinked-list-main.tar.gz
submission lab0lab0main
Diffstat (limited to 'linked_list.h')
-rw-r--r--linked_list.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/linked_list.h b/linked_list.h
new file mode 100644
index 0000000..aefdf29
--- /dev/null
+++ b/linked_list.h
@@ -0,0 +1,22 @@
+#pragma once
+
+struct list_item {
+ int value;
+ struct list_item *next;
+};
+
+/* Put x at the end of the list. */
+void append(struct list_item *first, int x);
+
+/* Put x at the beginning of the list. */
+void prepend(struct list_item *first, int x);
+
+/* Print att elements in the list. */
+void print(struct list_item *first);
+
+/* Find the first element in the list larger than x and input x right before
+ * that element. */
+void input_sorted(struct list_item *first, int x);
+
+/* Free everything dynamically located. */
+void clear(struct list_item *first);