This commit is contained in:
Walter Schenk 2025-12-14 20:23:30 +01:00
parent 94d625fc77
commit 0c020ba402

View File

@ -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.