How to make a chessboard in C?
<p>I am new to C and I am trying to make a program that would output a chessboard pattern. But, I don't understand what my next steps are going to be . Could anyone help me with this?</p>

<p>Main:</p>

<pre><code>#include &lt;stdio.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;string.h&gt;
#include &lt;stdbool.h&gt;

int main() {
    int length,width;
    enum colors{Black,White};

    printf("Enter the length:\n");
    scanf("%d",length);
    printf("Enter the width:\n");
    scanf("%d",width);

    int board[length][width];
    createBoard(length,width);
    for(int i =0;i&lt; sizeof(board);i++) {

        if(i%2==0) {
            // To print black
            printf("[X]");
        }
        else {
            // To print white
            printf("[ ]");
        }
    }
} //main
</code></pre>

<p>CreateBoard function:</p>

<pre><code>int createBoard(int len, int wid){
    bool b = false;
    for (int i = 0; i &lt; len; i++ ) {
        for (int j = 0; j &lt; wid; j++ ) {
            // To alternate between black and white
            if(b = false) {
                board[i][j] = board[White][Black];
                b = false;
            }
            else {
                board[i][j] = board[Black][White];
                b = true;
            }
        }
    }
    return board;
}
</code></pre>