/
ft_print_btree.c
52 lines (48 loc) · 1.47 KB
/
ft_print_btree.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
41
42
43
44
45
46
47
48
49
50
51
52
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_print_btree.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: grass-kw <grass-kw@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2014/03/10 09:09:46 by grass-kw #+# #+# */
/* Updated: 2014/03/18 16:36:31 by grass-kw ### ########.fr */
/* */
/* ************************************************************************** */
#include "eval_expression.h"
#include "stdio.h"
#include "libft/includes/libft.h"
void ft_print_btree(t_btree *root)
{
t_btree *tmp;
tmp = root;
if (!tmp)
{
ft_putendl("la creation de l'arbre a echouer");
exit(0);
}
else
{
ft_putstr(tmp->str);
ft_putstr(" : ");
ft_putnbr(tmp->key);
ft_putendl("");
if (tmp->left)
ft_print_btree(tmp->left);
if (tmp->right)
ft_print_btree(tmp->right);
}
}
void ft_print_list(t_list *list)
{
t_list *tmp;
tmp = list;
while (tmp)
{
ft_putstr(tmp->str);
ft_putstr(" : ");
ft_putnbr(tmp->key);
ft_putendl("");
tmp = tmp->next;
}
}