forked from AingeruAlvarezSanchez/Libft
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ft_btree_create_node.c
34 lines (31 loc) · 1.26 KB
/
ft_btree_create_node.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_btree_create_node.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: josesanc <josesanc@student.42malaga.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/18 19:40:22 by josesanc #+# #+# */
/* Updated: 2023/02/18 19:40:22 by josesanc ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include <stdlib.h>
/**
* @brief Creates a new tree node with item
* as a the content.
* @param item
* @return t_btree* the new node or null if allocation failed
*/
t_btree *btree_create_node(void *item)
{
t_btree *res;
res = (t_btree *) malloc (sizeof(t_btree));
if (res != NULL)
{
res->item = item;
res->left = NULL;
res->right = NULL;
}
return (res);
}