My speller seg faults at the space following the first word in whatever input text I use. Here is the gdb output for austinpowers.txt with the segfault just after reading the word AUSTIN:
107 else if (index > 0)
(gdb) n
110 word[index] = '\0';
(gdb) n
113 words++;
(gdb) print words
$13 = 0
(gdb) n
116 getrusage(RUSAGE_SELF, &before);
(gdb) n
117 bool misspelled = !check(word);
(gdb) n
Program received signal SIGSEGV, Segmentation fault.
0x0000000000401095 in check (word=0x7fffffffdc10 "AUSTIN") at dictionary.c:61
61 if (crawler->subnode[index] == NULL)
(gdb)
Here is the dictionary.c code at the offending line (#61):
if (word[i] == '\'')
{
index = 26;
}
if (crawler->subnode[index] == NULL)
{
return false;
}
crawler->crawlersubnode[index];
}
return crawler->isword;
Thanks is advance for any help.