-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlist.c
More file actions
46 lines (41 loc) · 1.31 KB
/
list.c
File metadata and controls
46 lines (41 loc) · 1.31 KB
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
39
40
41
42
43
44
45
46
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* list.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mmodise <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/03/21 13:40:43 by mmodise #+# #+# */
/* Updated: 2016/04/28 12:37:06 by mmodise ### ########.fr */
/* */
/* ************************************************************************** */
#include "grimly.h"
#include <stdlib.h>
t_list *ft_create_elem(char data)
{
t_list *tmp;
tmp = (t_list*)malloc(sizeof(t_list));
if (tmp)
{
tmp->next = NULL;
tmp->data = data;
}
return (tmp);
}
void ft_list_push_back(t_list **begin_list, char data)
{
t_list *list;
list = *begin_list;
if (!list)
{
list = ft_create_elem(data);
}
else
{
while ((list)->next)
{
list = list->next;
}
list->next = ft_create_elem(data);
}
}