-
Notifications
You must be signed in to change notification settings - Fork 2
/
ft_lstnew.c
36 lines (32 loc) · 1.38 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstnew.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: cado-car <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/07/31 11:57:06 by cado-car #+# #+# */
/* Updated: 2021/07/31 11:59:26 by cado-car ### ########lyon.fr */
/* */
/* ************************************************************************** */
/*
* DESCRIPTION
* Allocates (with malloc(3)) and returns a new element. The variable ’content’
* is initialized with the value of the parameter ’content’. The variable
* ’next’ is initialized to NULL.
* PARAMETERS
* #1. The content to create the new element with.
* RETURN VALUES
* The new element.
*/
#include "libft.h"
t_list *ft_lstnew(void *content)
{
t_list *elem;
elem = malloc(sizeof(t_list));
if (elem == NULL)
return (NULL);
elem->content = content;
elem->next = NULL;
return (elem);
}