-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstadd_front_bonus.c
33 lines (31 loc) · 1.28 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstadd_front.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: kyungkim <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/11/28 12:43:01 by kyungkim #+# #+# */
/* Updated: 2024/12/02 16:35:10 by kyungkim ### ########.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 *first = ft_lstnew("test");
t_list *second = ft_lstnew("test2");
printf("%p %s\n",first, (char *)first->content);
printf("%p %s\n",second, (char *)second->content);
ft_lstadd_front(&first, second);
printf("%p %s\n %p",first, (char *)first->content, first->next);
}
*/