-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathft_lstnew.c
34 lines (30 loc) · 1.33 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstnew.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: apuchill <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/02/03 17:25:35 by apuchill #+# #+# */
/* Updated: 2020/02/19 14:04:23 by apuchill ### ########.fr */
/* */
/* ************************************************************************** */
/*
** LIBRARY: N/A
** SYNOPSIS: create new list
**
** 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.
*/
#include "libft.h"
t_list *ft_lstnew(void *content)
{
t_list *new;
if (!(new = (t_list *)malloc(sizeof(t_list))))
return (0);
new->content = content;
new->next = NULL;
return (new);
}