aboutsummaryrefslogtreecommitdiff
path: root/c12/ex05
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-07-17 19:30:52 +0200
committerCharles <sircharlesaze@gmail.com>2019-07-17 19:30:52 +0200
commit880102ae9358db130ef67cc9a7177a1e1de76875 (patch)
treeb5929722cf123e7c1701f4bc164a905f79510bf5 /c12/ex05
parentdcf89e9366538c70fc08ceaabd5b770f5d5b890d (diff)
downloadpiscine-880102ae9358db130ef67cc9a7177a1e1de76875.tar.gz
piscine-880102ae9358db130ef67cc9a7177a1e1de76875.tar.bz2
piscine-880102ae9358db130ef67cc9a7177a1e1de76875.zip
c10 tail stuff, c11 start, c12/c13 files
Diffstat (limited to 'c12/ex05')
-rw-r--r--c12/ex05/ft_list_push_strs.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/c12/ex05/ft_list_push_strs.c b/c12/ex05/ft_list_push_strs.c
index 516fa7e..e56cd18 100644
--- a/c12/ex05/ft_list_push_strs.c
+++ b/c12/ex05/ft_list_push_strs.c
@@ -6,25 +6,29 @@
/* By: cacharle <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/07/09 17:18:23 by cacharle #+# #+# */
-/* Updated: 2019/07/09 17:52:44 by cacharle ### ########.fr */
+/* Updated: 2019/07/17 18:34:23 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_list.h"
+void list_push_front(t_list **begin_list, void *data)
+{
+ t_list *new_front;
+
+ new_front = ft_create_elem(data);
+ new_front->next = *begin_list;
+ *begin_list = new_front;
+}
+
t_list *ft_list_push_strs(int size, char **strs)
{
int i;
- t_list elem;
- t_list next;
+ t_list *list;
- next = NULL;
+ list = NULL;
i = 0;
while (i < size)
- {
- elem = ft_create_elem(strs[i]);
- elem->next = next;
- next = elem;
- }
- return (&elem);
+ list_push_front(&list, strs[i++]);
+ return (list);
}