-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstnew_bonus.c
32 lines (29 loc) · 1.24 KB
/
ft_lstnew_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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstnew_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: rruiz-sa <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/07 12:26:25 by rruiz-sa #+# #+# */
/* Updated: 2022/10/14 00:51:19 by rruiz-sa ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
t_list *ft_lstnew(void *content)
{
t_list *new_node;
new_node = (t_list *)malloc(sizeof(t_list));
if (!new_node)
return (NULL);
new_node->content = content;
new_node->next = NULL;
return (new_node);
}
/*
1- Create node
2- Create and check a malloc with the size of tlist
3- Add content to the node
4- Next value its a NULL
5- Return node
*/