Mercurial > hg > Applications > Grep
changeset 90:d139af3bbd67
remove static variable in printTree.cc
author | Masataka Kohagura <kohagura@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 23 Oct 2015 17:48:01 +0900 |
parents | 50a146c05192 |
children | 912d7bd51f38 |
files | c/regexParser/printTree.cc |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/c/regexParser/printTree.cc Fri Oct 23 17:20:54 2015 +0900 +++ b/c/regexParser/printTree.cc Fri Oct 23 17:48:01 2015 +0900 @@ -1,11 +1,10 @@ #include <stdio.h> #include "regexParser.h" -void descendTree(NodePtr n) { - static int d = 0; +void descendTree(NodePtr n, int d) { if (n->right != NULL) { d++; - descendTree(n->right); + descendTree(n->right, d); d--; } if (n->tokenType == 'a') { @@ -16,13 +15,14 @@ if (n->left != NULL) { d++; - descendTree(n->left); + descendTree(n->left, d); d--; } } void printTree(NodePtr n) { puts("---Print Node----"); - descendTree(n); + int d = 0; + descendTree(n,d); puts("-----------------"); }