I'm writing a spellchecking program using a hash table. The hash table (a char * array) serves as the dictionary, storing words inputted from a file. However, a segmentation fault occurs before I can get through reading, hashing, and inserting all 60,389 words (the words are in alphabetical order, and the fault occurs after "reloads"). Any suggestions on how to figure out where the segmentation fault is coming from would be greatly appreciated.

The attached files:

1. spellcheck.cpp contains the main function, calling the Dictionary class member function "add" on every word in the file wordlist.txt.
2. hashTable.cpp contains definitions for functions in the Dictionary class. The "add" and "getIndex" functions are the only ones that are functional right now.
3. hashTable.h contains declarations.
4. wordlist.txt contains all the words that need to go in the dictionary.
5. input.txt is the input to the program, but isn't actually being used for anything yet.

Er, never mind. I'm not entirely sure what I did that fixed it, but I'm able to read in the whole file now. Sorry for the inconvenience.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.