Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "node.h"
- #include <stdio.h>
- typedef Node* Node_ptr
- void my_print(Node_ptr *root_ptr) {
- Node root = *root_ptr;
- if (root == NULL) return;
- printf("%d", root->data);
- if (root->left != NULL)
- my_print(&(root->left));
- else
- my_print(&(root->right));
- if (root->left == NULL && root->right == NULL)
- *root_ptr = NULL;
- }
- void print_all_paths(Node *root) {
- while (*root != NULL)
- my_print(&root);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement