aboutsummaryrefslogtreecommitdiff
path: root/sem1/algo/mm2/linked/main.c
diff options
context:
space:
mode:
authorJulian T <julian@jtle.dk>2020-02-11 12:24:56 +0100
committerJulian T <julian@jtle.dk>2020-02-11 12:24:56 +0100
commit6db1a2cdd3b96731f2e092d55d8c2136eabc52d0 (patch)
tree2be8fae8ce82d708ed9f00f376dda14420850e80 /sem1/algo/mm2/linked/main.c
parent57305119e05559c1c37e903aef89cd43f44c42c9 (diff)
Rename and cleanup
Diffstat (limited to 'sem1/algo/mm2/linked/main.c')
-rw-r--r--sem1/algo/mm2/linked/main.c45
1 files changed, 0 insertions, 45 deletions
diff --git a/sem1/algo/mm2/linked/main.c b/sem1/algo/mm2/linked/main.c
deleted file mode 100644
index 72b62cc..0000000
--- a/sem1/algo/mm2/linked/main.c
+++ /dev/null
@@ -1,45 +0,0 @@
-#include <stdio.h>
-#include "node.h"
-#include "llist.h"
-
-void list_print(node_t *root) {
- int index = 0;
- /* Loop through notes and print them */
- while( root != NULL ) {
- /* Print a value */
- printf("%d: %d\n", index++, root->val);
-
- /* Next value */
- root = root->next;
- }
-}
-
-/* Remove node */
-int main() {
-
- /* Do some stuff */
- llist_t list;
- llist_init(&list);
-
- llist_append(&list, 11); // 0
- llist_append(&list, 22); // 1
- llist_append(&list, 33); // 2
- llist_append(&list, 44); // 3
- llist_append(&list, 89); // 4
- llist_append(&list, 12); // 5
- llist_append(&list, 2); // 6
- llist_append(&list, 1); // 7
- llist_append(&list, 7); // 8
- llist_append(&list, 232);// 9
-
- list_print(list.root);
- printf("%d\n", llist_get(&list, 5));
- llist_pop(&list, 9);
- printf("%d\n", llist_get(&list, 7));
-
- list_print(list.root);
-
- while( list.len ) {
- printf("Popped %d\n", llist_pop(&list, 0));
- }
-}