jamoin
This commit is contained in:
parent
94d625fc77
commit
0c020ba402
10
bintree.c
10
bintree.c
@ -86,8 +86,7 @@ void *nextTreeData(TreeNode *root)
|
|||||||
stack = push(stack,root);
|
stack = push(stack,root);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result->data;
|
return result;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -95,7 +94,12 @@ void *nextTreeData(TreeNode *root)
|
|||||||
// Releases all memory resources (including data copies).
|
// Releases all memory resources (including data copies).
|
||||||
void clearTree(TreeNode *root)
|
void clearTree(TreeNode *root)
|
||||||
{
|
{
|
||||||
|
TreeNode* clear = nextTreeData(root);
|
||||||
|
while(clear != NULL){
|
||||||
|
free(clear->data);
|
||||||
|
free(clear);
|
||||||
|
clear = nextTreeData(NULL);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the number of entries in the tree given by root.
|
// Returns the number of entries in the tree given by root.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user