jamoin
This commit is contained in:
@@ -86,8 +86,7 @@ void *nextTreeData(TreeNode *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).
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user