This is the first time I've used recursion to do something other than find the factorial of a number. I'm building a program to find words in a boggle board. Following is the function that is resulting in segfaults:
void findWord(vector<string>& board, set<string>& dictionary,
string prefix, int row, int column){
prefix += getTile(board, row, column);
if(prefix.length() > biggestWordLength)
return;
if(isOutOfBounds(row, column))
return;
if(isWord(prefix, dictionary) == 1)
foundWords.insert(prefix);
if(isWord(prefix, dictionary) == 0)
return;
//Note: this does not prevent using the same tile twice in a word
findWord(board, dictionary, prefix, row-1, column-1);
findWord(board, dictionary, prefix, row-1, column);
findWord(board, dictionary, prefix, row-1, column+1);
findWord(board, dictionary, prefix, row, column-1);
findWord(board, dictionary, prefix, row, column+1);
findWord(board, dictionary, prefix, row+1, column-1);
findWord(board, dictionary, prefix, row+1, column);
findWord(board, dictionary, prefix, row+1, column+1);
}