-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstadd_front.c
43 lines (37 loc) · 1.39 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstadd_front.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: julmuntz <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/06/03 16:39:32 by julmuntz #+# #+# */
/* Updated: 2022/06/03 18:33:56 by julmuntz ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstadd_front(t_list **lst, t_list *new)
{
if (new != *lst)
new->next = *lst;
*lst = new;
}
/*
#include <stdio.h>
int main()
{
t_list *st0 = ft_lstnew("James");
t_list *st1 = ft_lstnew("Jonah");
t_list *st2 = ft_lstnew("Jameson");
t_list *st3 = ft_lstnew("Junior");
ft_lstadd_front(&st0, st3);
ft_lstadd_front(&st3, st1);
ft_lstadd_front(&st1, st2);
while (st1)
{
printf("%s. ", (char *)st1->content);
st1 = st1->next;
}
printf("\n");
}
*/