-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathft_lstnew.c
More file actions
43 lines (38 loc) · 1.36 KB
/
ft_lstnew.c
File metadata and controls
43 lines (38 loc) · 1.36 KB
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
42
43
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstnew.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: sde-silv <sde-silv@student.42berlin.de> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/10/04 13:51:05 by sde-silv #+# #+# */
/* Updated: 2023/10/04 13:51:21 by sde-silv ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
t_list *ft_lstnew(void *content)
{
t_list *new_node;
new_node = malloc(sizeof(t_list));
if (!new_node)
return (0);
new_node->content = content;
new_node->next = 0;
return (new_node);
}
/*
int main(void)
{
t_list *head;
t_list *current;
head = ft_lstnew((void *)10);
head->next = ft_lstnew((void *)20);
current = head;
while (current != NULL)
{
printf("%zu\n", (size_t)current->content);
current = current->next;
}
return (0);
}
*/