-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lstnew.c
40 lines (34 loc) · 1.3 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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lstnew.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: mcosta-d <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/05/07 21:41:04 by mcosta-d #+# #+# */
/* Updated: 2023/05/07 21:41:04 by mcosta-d ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
t_list *ft_lstnew(void *content)
{
t_list *new;
new = malloc(sizeof(t_list));
if (!new)
return (0);
new->content = (void *)content;
new->next = NULL;
return (new);
}
/* #include <stdio.h>
int main()
{
t_list *list;
t_list *ptr;
list = NULL;
ptr = ft_lstnew("e ai");
list = ptr;
printf("elemento adicionado é %s\n", (char *)ptr->content);
return (0);
}
*/