I was testing my program with different texts and I found out that my code lists all words with apostrophes as misspelled, even though I have an if statement in my load function that checks for any apostrophes. Is this if statement causing the issue? Thank you in advance.

My code:

// edited out per academic honesty

1 Answer 1


You have:

else if (l == '\'' && trav->children[26] == NULL)
    trav->children[26] = calloc(1, sizeof(node));

So, what if you do have an apostrophe but trav->children[26] is not NULL?

I suggest you add another condition like:

else if (l == '\'' && trav->children[26] != NULL)
    trav = trav->children[26];
  • I added that but it didn't work. I added that statement behind the statement that checks if it is an apostrophe AND if it IS null. Is there something else I'm missing? Commented Oct 28, 2016 at 14:08
  • The trav = trav->children[26]; would have to be in both blocks
    – Blauelf
    Commented Oct 28, 2016 at 14:13
  • true! @@Blauelf Commented Oct 28, 2016 at 14:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .