-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstadd_front_bonus.c
45 lines (41 loc) · 1.49 KB
/
ft_lstadd_front_bonus.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: ldel-val <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/09 12:37:18 by ldel-val #+# #+# */
/* Updated: 2024/10/09 19:30:09 by ldel-val ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstadd_front(t_list **lst, t_list *new)
{
if (new)
{
new->next = *lst;
*lst = new;
}
}
/*
int main(void)
{
t_list *head;
int content1;
int content2;
int content3;
content1 = 42;
content2 = 12;
content3 = 33;
head = (t_list *)malloc(sizeof(t_list));
head->content = &content1;
head->next = (t_list *)malloc(sizeof(t_list));
head->next->content = &content2;
head->next->next = (t_list *)malloc(sizeof(t_list));
head->next->next->content = &content3;
head->next->next->next = NULL;
t_list *new_node;
new_node = (t_list *)malloc(sizeof(t_list));
ft_lstadd_front(head, new_node);
}*/