I have implemented load successfully. When I run speller, words load until the end of file. However, my check function does not work and according to GDB, speller stops when appending chars to word, which is in a for loop, in an if statement ("preparing to spell-check" in speller.c). Maybe because I've been looking at my lines of code for a long time, but I can't figure out what's wrong.
I will post my code below, but please tell me if I should remove it. I do not want solutions, just some hints. Thank you all!
bool check(const char* word)
{
int new_nmb = 0;
root = malloc(sizeof(node));
for (int i = 0, n = strlen(word); i < n; i++)
{
point = root;
if (isalpha(word[i]))
{
new_nmb = word[tolower(i)] - 'a';
if (word[i] == '\'')
{
new_nmb = 26;
}
if (point->children[new_nmb] == NULL)
{
return false;
}
else
point = point->children[new_nmb];
}
if (word[i] == '\0' && point->is_word == true)
{
return true;
}
}
return true;
}