aboutsummaryrefslogtreecommitdiff
path: root/list/src/list.c
diff options
context:
space:
mode:
Diffstat (limited to 'list/src/list.c')
-rw-r--r--list/src/list.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/list/src/list.c b/list/src/list.c
new file mode 100644
index 0000000..f5b6507
--- /dev/null
+++ b/list/src/list.c
@@ -0,0 +1,14 @@
1#include "list.h"
2
3#include <assert.h>
4
5void list_make(list* list, size_t size) {
6 if (size == 0) {
7 return;
8 }
9 assert(list);
10 for (size_t i = 0; i < size; ++i) {
11 list[i].prev = (i == 0 ? 0 : &list[i - 1]);
12 list[i].next = (i == size - 1 ? 0 : &list[i + 1]);
13 }
14}