-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstnew.c
49 lines (42 loc) · 1.37 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
42
43
44
45
46
47
48
49
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstnew.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: elel-yak <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/10/08 18:42:52 by elel-yak #+# #+# */
/* Updated: 2022/10/27 14:04:04 by elel-yak ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
t_list *ft_lstnew(void *content)
{
t_list *lst;
lst = (t_list *)malloc(sizeof(t_list));
if (!lst)
return (0);
lst->content = content;
lst->next = 0;
return (lst);
}
// int main()
// {
// int i;
// t_list *ptr;
// t_list *head;
// i = 0;
// ptr=ft_lstnew("H");
// head = ptr;
// while (i < 5)
// {
// ptr->next = ft_lstnew("k");
// ptr = ptr->next;
// i++;
// }
// while(head)
// {
// printf("%s\n", head->content);
// head = head->next;
// }
// }