comparison c/regexParser/printTree.cc @ 79:52da06c3f050

add printTree.cc & fix Makefile
author Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp>
date Tue, 29 Sep 2015 18:36:31 +0900
parents
children 50a146c05192
comparison
equal deleted inserted replaced
78:23a96fefa643 79:52da06c3f050
1 #include <stdio.h>
2 #include "regexParser.h"
3
4 void descendTree(NodePtr n) {
5 static int d = 0;
6 if (n->right != NULL) {
7 d++;
8 descendTree(n->right);
9 d--;
10 }
11 printf("%*c%c\n",d*4, ' ',n->Value.character);
12 if (n->left != NULL) {
13 d++;
14 descendTree(n->left);
15 d--;
16 }
17 }
18
19 void printTree(NodePtr n) {
20 puts("---Print Node----");
21 descendTree(n);
22 puts("-----------------");
23 }