jeudi 29 juillet 2021

Need assistance resolving read access violation within a for loop

I am writing a program that will solve sudoku puzzles given a partially solved puzzle. In a for loop that I have composed to go through each element within a row, I am receiving a read access violation exception.

Here is the code that is causing the exception to be thrown:


bool sudoku::numAlreadyInRow(int row, int num)
{
    for (int j = 0; j < 9; j++) 
    {
        cout << "Before ";
        if (grid[row][j] == num)
        {
            cout << "Iterations: " << j;
            return true;
        }
          
    }
    return false;
}

If someone could help me to resolve this issue it would be greatly appreciated.

ETA: the exception says this was was 0xCE2DC5F6

Aucun commentaire:

Enregistrer un commentaire