This commit is contained in:
Bohdan Kapliuk 2024-03-13 18:40:45 +02:00
parent 555af18e67
commit 3fee54f9f2
2 changed files with 9 additions and 3 deletions

View File

@ -1,12 +1,17 @@
#include "list_ops.h" #include "list_ops.h"
#include <string.h>
list_t *new_list(size_t length, list_element_t elements[]){ 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){ list_t *append_list(list_t *list1, list_t *list2){
return NULL;
return list2;
} }

View File

@ -3,6 +3,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h> #include <stdbool.h>
#include <string.h>
typedef int list_element_t; typedef int list_element_t;