The following is a function I wrote to go along with a minesweeper program. For some crazy reason, the inner loop gets skipped after i begins to increment. For example, after i and j have been reduced by one:
n = 3, k =3
i = 0
j = 0, j = 1, j = 2
i = 1
i = 2

void checkaddnum(int board[][SIZE],int i, int j) {

    int n = i + 2;
    int k = j + 2;
    i -= 1;
    j -= 1;

    for (i; i < n; i++){
        for (j; j < k; j++){
            if (inbounds(board,i,j))
                continue;
            else
                board[i][j] += 1;
        }
    }
}

I also get the unused value warning for my two for loops and I do not know why. Any help would be greatly appreciated.

How do you know what the values of i and j are to give us the example? Please sghow us the actual code that produced that actual output.

the i and j come from going through the minesweeper and finding which board[i][j] has a bomb, which is marked with a 9. I include the function that locates the i j and then brings me to the function, which I am having problems with.

void addnums(int board[][SIZE]) {

    int i, j;

    for (i = 0; i < SIZE; i++){
        for (j = 0; j < SIZE; j++) {
            if (board [i][j] == 9)
                checkaddnum(board, i, j);
            else
                continue;
        }
    }
}


void checkaddnum(int board[][SIZE],int i, int j) {

    int n = i + 2;
    int k = j + 2;
    i -= 1;
    j -= 1;

    for (i; i < n; i++){
        for (j; j < k; j++){
            if (inbounds(board,i,j))
                continue;
            else
                board[i][j] += 1;
        }
    }
}

I figured out what was wrong. I needed to reinitialize my j before the 2nd loop runs again. So before the loops I added the line int temp = j and put j = temp before the 2nd loop. So simple, but I just didn't see it at the time.

This question has already been answered. Start a new discussion instead.