Advertisement
andreclemencio

Untitled

Mar 30th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. void print_tree(int nivel, node root){
  2. int i;
  3. if (root == NULL)
  4. return;
  5.  
  6. for (i = 0; i<nivel; ++i){
  7. printf("..");
  8. }
  9. if (root->child == NULL){
  10. if (root->val != NULL && strcmp(root->val,empty)!=0){
  11. printf("%s(%s)\n",root->type, root->val);
  12. }
  13. else{
  14. printf("%s\n",root->type);
  15. }
  16. return;
  17. }
  18.  
  19. printf("%s\n", root->type);
  20.  
  21. while (root->child != NULL){
  22. print_tree(nivel+1,root->child->child);
  23. }
  24.  
  25. return;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement