-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstadd_front.c
42 lines (39 loc) · 1.38 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstadd_front.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sde-silv <sde-silv@student.42berlin.de> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/10/04 13:50:25 by sde-silv #+# #+# */
/* Updated: 2023/10/04 13:50:54 by sde-silv ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstadd_front(t_list **lst, t_list *new)
{
new->next = *lst;
*lst = new;
}
/*
int main(void)
{
t_list *head;
t_list *current;
t_list **lst;
t_list *new;
head = ft_lstnew((void *)10);
head->next = ft_lstnew((void *)20);
new = ft_lstnew((void *)30);
*lst = head;
new = ft_lstnew((void *)30);
ft_lstadd_front(lst, new);
current = *lst;
while (current != NULL)
{
printf("%zu\n", (size_t)current->content);
current = current->next;
}
return (0);
}
*/