From 38866c562ee404eb52a536785a5e7fafe7951185 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustav=20S=C3=B6rn=C3=A4s?= Date: Tue, 26 Jan 2021 14:22:46 +0100 Subject: submission lab0 --- linked_list.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 linked_list.h (limited to 'linked_list.h') 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); -- cgit v1.2.1