diff --git a/0x11-singly_linked_lists/4-free_list.c b/0x11-singly_linked_lists/4-free_list.c new file mode 100644 index 0000000..b424619 --- /dev/null +++ b/0x11-singly_linked_lists/4-free_list.c @@ -0,0 +1,17 @@ +#include "lists.h" +/** + * free_list - frees all elements in a list_t list. + * @h: list to be freed. + * Return: NONE. + */ +void free_list(list_t *head) +{ + list_t *copy; + + for (; head != NULL; head = copy) + { + copy = head->next; + free(head->str); + free(head); + } +} diff --git a/0x11-singly_linked_lists/e b/0x11-singly_linked_lists/e new file mode 100755 index 0000000..c88dd4a Binary files /dev/null and b/0x11-singly_linked_lists/e differ