-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_lstnew.c
36 lines (32 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
32
33
34
35
36
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstnew.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: gudaniel <gudaniel@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/15 16:40:44 by gudaniel #+# #+# */
/* Updated: 2024/04/25 13:44:00 by gudaniel ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
t_list *ft_lstnew(void *content)
{
t_list *node;
node = (t_list *)malloc(sizeof(t_list));
if (!node)
return (NULL);
node->content = content;
node->next = NULL;
return (node);
}
/* int main()
{
t_list *node = ft_lstnew("Hello, world!");
if (node)
{
printf("Content: %s\n", (char *)node->content);
printf("Next: %p\n", node->next);
}
return 0;
} */