diff --git a/cv4/list_ops.c b/cv4/list_ops.c index 0c7dd34..206ef26 100644 --- a/cv4/list_ops.c +++ b/cv4/list_ops.c @@ -1,12 +1,17 @@ #include "list_ops.h" +#include list_t *new_list(size_t length, list_element_t elements[]){ - return NULL; - + list_t* list = (list_t*)malloc(sizeof(list_t) + length * sizeof(list_element_t)); + list->length = length; + memcpy(list->elements,elements, length*sizeof(list_element_t)); + free(list); + return list; } list_t *append_list(list_t *list1, list_t *list2){ - return NULL; + + return list2; } diff --git a/cv4/list_ops.h b/cv4/list_ops.h index 14a56d8..e4989fe 100644 --- a/cv4/list_ops.h +++ b/cv4/list_ops.h @@ -3,6 +3,7 @@ #include #include +#include typedef int list_element_t;