I'm writing a c program, and my standard input looks something like this.
56543215
54176312
41235462
41235466
41255633
41256394
45236479
23696654
I'm trying to get this input into an 8x8 array and output the exact array. This is what I have so far but I don't get why it's not working? maybe because there are \n that I need to skip?
Should declaration of the array be int arr[7][7];
instead? since it starts at 0?
#include <stdio.h>
#define ROW 8
#define COL 8
int main(int argc, char *argv[]) {
int arr[ROW][COL];
for (int i = 0; i < ROW; i++) {
for (int j = 0; j < COL; j++) {
scanf("%d", &arr[i][j]);
}
}
for(int i = 0; i < ROW; i++) {
for(int j = 0; j < COL; j++) {
printf("%d", arr[i][j] );
}
printf("\n");
}
return 0;
}