In the function argument:
char arr[9][5]
In the loop:
for (i = 0; i<5; i++) {
    for (j = 0; j<9;j++) {
        if (arr[i][j] == 1)
You flipped the position of i and j. i should go from 0 to 9, j from 0 to 5.
0
solved garbage value in C array