diff --git a/exercises/ex06/good_list.c b/exercises/ex06/good_list.c deleted file mode 100644 index e0048f5e..00000000 --- a/exercises/ex06/good_list.c +++ /dev/null @@ -1,58 +0,0 @@ -/* Example code for Exercises in C. - -Based on an example from http://www.learn-c.org/en/Linked_lists - -Copyright 2016 Allen Downey -License: Creative Commons Attribution-ShareAlike 3.0 - -*/ - -#include -#include - -typedef struct node { - int val; - struct node *next; -} Node; - - -/* Makes a new node structure. -* -* val: value to store in the node. -* next: pointer to the next node -* -* returns: pointer to a new node -*/ -Node *make_node(int val, Node *next) { - Node *node = malloc(sizeof(Node)); - node->val = val; - node->next = next; - return node; -} - - -/* Prints the values in a list. -* -* list: pointer to pointer to Node -*/ -void print_list(Node **list) { - Node *current = *list; - - printf("[ "); - while (current != NULL) { - printf("%d ", current->val); - current = current->next; - } - printf("]\n"); -} - - -int main() { - Node *head = make_node(1, NULL); - head->next = make_node(2, NULL); - head->next->next = make_node(3, NULL); - head->next->next->next = make_node(4, NULL); - - Node **list = &head; - print_list(list); -}