forked from josanri/Libft_extended
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_btree_apply_prefix.c
30 lines (28 loc) · 1.27 KB
/
ft_btree_apply_prefix.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_btree_apply_prefix.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: josesanc <josesanc@student.42malaga.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/18 19:40:25 by josesanc #+# #+# */
/* Updated: 2023/02/18 19:40:25 by josesanc ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
/**
* @brief Applies a function to the items of the tree
* first to the root, and then, to the children (root, left, right)
* on every node.
* @param root
* @param applyf
*/
void ft_btree_apply_prefix(t_btree *root, void (*applyf)(void *))
{
if (root != NULL)
{
applyf(root->item);
ft_btree_apply_prefix(root->left, applyf);
ft_btree_apply_prefix(root->right, applyf);
}
}