-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_lstadd_front_bonus.c
More file actions
39 lines (35 loc) · 1.38 KB
/
ft_lstadd_front_bonus.c
File metadata and controls
39 lines (35 loc) · 1.38 KB
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstadd_front_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: lcosta-g <lcosta-g@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/09 13:18:34 by lcosta-g #+# #+# */
/* Updated: 2024/10/26 13:37:55 by lcosta-g ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
void ft_lstadd_front(t_list **lst, t_list *new)
{
if (!lst || !new)
return ;
new->next = *lst;
*lst = new;
}
/*
#include <stdio.h>
int main(void)
{
t_list *lst;
t_list *new;
new = ft_lstnew("ft_lstadd_front example");
lst = ft_lstnew("ft_lstnew example");
printf("Content before: %s\n", (char *)lst->content);
printf("Next before: %p\n", lst->next);
ft_lstadd_front(&lst, new);
printf("Content after: %s\n", (char *)lst->content);
printf("Next after: %p\n", lst->next);
return (0);
}
*/