Please Help me with my C Homework


The assignment is to search a 4x4 board of characters for words in the dictionary by starting at a tile and moving up, down, left, right, or diagonally at any point. For some reason, my program seems to "jump" from one point to another, spelling words from letters that aren't adjacent, and adding words many times. Could anyone share an idea of why this could be happening? Thank you!

void goToNextLetter(struct trie* dictionary, char boggleBoard[SIDELENGTH][SIDELENGTH], int usedLetters[SIDELENGTH][SIDELENGTH], char word[MAX], int row, int column){
    int i, rowTemp, colTemp;
    if (isPrefix(dictionary, word, 0)){
        if (isInDictionary(dictionary, word, 0)){
            printf("%s\n", word);
        //printf("%d\t%d\t%s\n", row, column, word);
        for (i=0; i<D_SIZE; i++){
            if ((rowTemp<SIDELENGTH) && (rowTemp>=0) && (colTemp>=0) && (colTemp<SIDELENGTH) && (usedLetters[rowTemp][colTemp]==0)){
                goToNextLetter(dictionary, boggleBoard, usedLetters, word, rowTemp, colTemp);
        //remove the last letter of word
        word[strlen(word)-1] = 0;