i ve been working struggling so much... please, a hint why i can make it work. I don t know how to return the result and make sure that the conditions are followed. here are my codes for unload :
`
/*
Frees all the children nodes one by one recursion, except the root
*/
void freeNode(node *temp_pointer)
{
//go through node's children // make sure to free the childrens and come back to the parent
for (int letter_position = 0; letter_position < 27; letter_position++)
{
//if children is a pointer so a parent to his children, check also that children)
if (temp_pointer->children[letter_position] != NULL)
{
freeNode(temp_pointer->children[letter_position]);
}
// when all children are null, it time to free node
else
{
free(temp_pointer);
}
}
}
/** * Unloads dictionary from memory. Returns true if successful else false. */ bool unload(void) { //FILE *fp = NULL;
//go through node's children // make sure to free the childrens and come back to the parent
for (int letter_position = 0; letter_position < 27; letter_position++)
{
//if children is a pointer so a parent to his children, check also that children)
if (root->children[letter_position] != NULL)
{
freeNode(root->children[letter_position]);
return false;
}
else
{
free(root);
return true;
}
}
} `