I would believe the problem is on your side. Are you sure you return a dynamically allocated buffer every time?
If you cannot find the problem with your solution, you can post it here (remember about code formatting and spoiler flag!), so we could check it.
the problem comes from your code, you are not setting the
tree_size
to0
for an empty treeI would believe the problem is on your side. Are you sure you return a dynamically allocated buffer every time?
If you cannot find the problem with your solution, you can post it here (remember about code formatting and spoiler flag!), so we could check it.