-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstnew_bonus.c
32 lines (28 loc) · 1.35 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: lclerc <lclerc@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/11/17 16:09:32 by lclerc #+# #+# */
/* Updated: 2022/11/24 13:57:21 by lclerc ### ########.fr */
/* */
/* ************************************************************************** */
/*
* ft_lstnew() allocates with malloc() and returns a new element. The member
* variable 'content' with the value of the parameter 'content' is initialized
* with the value of the parameter 'content'. The variable 'next' is
* initialized to NULL.
*/
#include "libft.h"
t_list *ft_lstnew(void *content)
{
t_list *new_node;
new_node = (struct s_list *)malloc(sizeof(t_list));
if (!new_node)
return (NULL);
new_node->content = content;
new_node->next = NULL;
return (new_node);
}