-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_arrtolst.c
38 lines (35 loc) · 1.3 KB
/
ft_arrtolst.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_arrtolst.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: srheede <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/06/04 08:51:54 by srheede #+# #+# */
/* Updated: 2018/06/08 11:42:40 by srheede ### ########.fr */
/* */
/* ************************************************************************** */
#include "../libft.h"
t_list *ft_arrtolst(char **arr)
{
t_list *list;
t_list *begin;
int i;
if (!arr)
begin = ft_lstnew(NULL, 0);
else
{
i = 0;
list = ft_lstnew(arr[i], ft_strlen(arr[i]));
begin = list;
i++;
while (arr[i])
{
list->next = ft_lstnew(arr[i], ft_strlen(arr[i]));
list = list->next;
i++;
}
list->next = ft_lstnew(arr[i], ft_strlen(arr[i]));
}
return (begin);
}