-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstadd_front.c
45 lines (40 loc) · 1.4 KB
/
ft_lstadd_front.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
39
40
41
42
43
44
45
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstadd_front.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: nmattera <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/05/18 17:04:35 by nmattera #+# #+# */
/* Updated: 2022/05/21 15:25:38 by nmattera ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstadd_front(t_list **lst, t_list *new)
{
new->next = *lst;
*lst = new;
}
/* #include <stdio.h>
int main()
{
t_list *first;
t_list *second;
t_list *third;
t_list *lecture;
int i;
lecture = malloc(sizeof(t_list));
lecture->next = third;
first = ft_lstnew("1");
second = ft_lstnew("2");
third = ft_lstnew("3");
ft_lstadd_front(&first, second);
ft_lstadd_front(&second, third);
i = 0;
while (lecture->next )
{
printf("%s\n", (char *)lecture->content);
lecture = lecture->next;
i++;
}
} */