Hi all,
I'm making a board using a 2D array in which there are 8 rows and 7 columns. The bottom four rows are filled with '1's and the top four are filled with '0's. I'm probably being a complete idiot but I can't get my compiler to print them off in rows and columns, it just prints them out in one long line. Here is said section of my code. Any help regarding this would be amazing. Thanks!
Code:#include <stdio.h> #define ROW 8 #define COL 7 int main(void) { int board[ROW][COL]; int i, j; for (i=0; i<ROW; i++) { for (j=0; j<COL; j++) { board[i][j] = 0; } } for (i=4; i<ROW; i++) { for (j=0; j<COL; j++) { board[i][j] = 1; } } for (i=0; i<ROW; i++) { for (j=0; j<COL; j++) { printf("%d", board[i][j]); } } printf("\n"); return 0; }