Bug fixes to C code.

This commit is contained in:
krahets
2023-11-01 05:14:22 +08:00
parent f7dd05e7a4
commit 355cc3a6b1
31 changed files with 246 additions and 219 deletions

View File

@@ -101,7 +101,7 @@ pub fn showTrunks(p: ?*Trunk) void {
// The interface of the tree printer
// Print a binary tree
pub fn printTree(root: ?*TreeNode(i32), prev: ?*Trunk, isLeft: bool) !void {
pub fn printTree(root: ?*TreeNode(i32), prev: ?*Trunk, isRight: bool) !void {
if (root == null) {
return;
}
@@ -113,7 +113,7 @@ pub fn printTree(root: ?*TreeNode(i32), prev: ?*Trunk, isLeft: bool) !void {
if (prev == null) {
trunk.str = "———";
} else if (isLeft) {
} else if (isRight) {
trunk.str = "/———";
prev_str = " |";
} else {