-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstnew.c
31 lines (28 loc) · 1.25 KB
/
ft_lstnew.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstnew.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mgraf <mgraf@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/14 15:40:13 by mgraf #+# #+# */
/* Updated: 2022/12/14 16:06:16 by mgraf ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/**
* @brief Allocates and returns a new element of a linked list.
*
* @param content The content to be added to the new element.
* @return The new element of the linked list.
*/
t_list *ft_lstnew(void *content)
{
t_list *node;
node = (t_list *)malloc(sizeof(*node));
if (!node)
return (NULL);
node->content = content;
node->next = NULL;
return (node);
}