41 lines
1.3 KiB
C
41 lines
1.3 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* ft_lstnew_bonus.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: kcolin <marvin@42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2024/10/21 11:19:42 by kcolin #+# #+# */
|
|
/* Updated: 2024/10/21 11:25:46 by kcolin ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "libft.h"
|
|
#include <stdlib.h>
|
|
|
|
t_list *ft_lstnew(void *content)
|
|
{
|
|
t_list *out;
|
|
|
|
out = malloc(sizeof(t_list));
|
|
if (out == NULL)
|
|
return (NULL);
|
|
out->content = content;
|
|
out->next = NULL;
|
|
return (out);
|
|
}
|
|
|
|
/*
|
|
#include <stdio.h>
|
|
|
|
int main(void)
|
|
{
|
|
t_list *list;
|
|
|
|
list = ft_lstnew("Hello There!");
|
|
printf("content:\t%s\n", (char *)list->content);
|
|
printf("next:\t%p\n", list->next);
|
|
free(list);
|
|
return (0);
|
|
}
|
|
*/
|