'Warning: control reaches end of non void function

I'm pretty sure I have the correct return statement so i don't know why it shows this.

/* check table full function */

bool check_table_full (char board[][SIZE])
{
    int row, col;

    for (row = 0; row < SIZE; row++) {
    for (col = 0; col < SIZE; col++) {
        if (board[row][col] != '_') {
        return true;
        }
        else {
        return false;
        }
    }
    }
}


Solution 1:[1]

The compiler often can’t understand what seems to be obvious to humans. You need a default return at the end to convince the compiler. Or restructure the function so you are not returning in the middle of the function.

Solution 2:[2]

This code will work:

bool check_table_full (char board[][SIZE])
{
    int row, col;

    for (row = 0; row < SIZE; row++) {
        for (col = 0; col < SIZE; col++) {
            if (board[row][col] != '_') {
                return true;
            }
        }
    }
    return false;
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Brian Clink
Solution 2 Dada