-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstnew_bonus.c
32 lines (29 loc) · 1.21 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.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: estettle <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/10/11 11:47:18 by estettle #+# #+# */
/* Updated: 2024/10/11 11:47:19 by estettle ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/* ft_lstnew()
* this function allocates a new lst item and returns it, adding the content
* parameter to it
*/
t_list *ft_lstnew(void *content)
{
t_list *new_lst;
new_lst = malloc(sizeof(t_list));
if (!new_lst)
{
free(new_lst);
return (NULL);
}
new_lst->content = content;
new_lst->next = NULL;
return (new_lst);
}