-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstnew.c
executable file
·41 lines (34 loc) · 1.41 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
32
33
34
35
36
37
38
39
40
41
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstnew.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: jchoy-me <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/07/19 10:57:31 by jchoy-me #+# #+# */
/* Updated: 2023/07/19 16:52:43 by jchoy-me ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/*
DESCRIPTION:
Allocates (with malloc(3)) and returns a new node. The member variable
’content’ is initialized with the value of the parameter ’content’.
The variable ’next’ is initialized to NULL.
PARAMETERS:
content: The content to create the node with.
RETURN VALUE:
The new node.
EXTERNAL FUNCTIONS:
malloc
*/
t_list *ft_lstnew(void *content)
{
t_list *node;
node = (t_list *) malloc(sizeof(t_list));
if (node == NULL)
return (NULL);
node -> content = content;
node -> next = NULL;
return (node);
}