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