Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Rudolf
/
huffman
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
bd0005cf
authored
Mar 22, 2017
by
Rudolf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tree printing support (left->right)
parent
35753548
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
0 deletions
print_helper.c
print_helper.h
print_helper.c
View file @
bd0005cf
...
@@ -45,3 +45,16 @@ void print_char(unsigned char c)
...
@@ -45,3 +45,16 @@ void print_char(unsigned char c)
break
;
break
;
}
}
}
}
void
print_tree
(
struct
tree
*
r
,
int
l
)
{
int
i
;
if
(
!
r
)
return
;
print_tree
(
r
->
right
,
l
+
1
);
for
(
i
=
0
;
i
<
l
;
++
i
)
printf
(
" "
);
print_char
(
r
->
ch
);
print_tree
(
r
->
left
,
l
+
1
);
}
print_helper.h
View file @
bd0005cf
...
@@ -21,5 +21,6 @@ void __printb(void *value, size_t size);
...
@@ -21,5 +21,6 @@ void __printb(void *value, size_t size);
})
})
void
print_char
(
unsigned
char
c
);
void
print_char
(
unsigned
char
c
);
void
print_tree
(
struct
tree
*
r
,
int
l
);
#endif
/* _PRINT_HELPER_H_ */
#endif
/* _PRINT_HELPER_H_ */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment