The board[][] array is a global variable. In both functions, the code is creating a shadow array called board[][]
.
int board[DIM_MAX][DIM_MAX];
By redeclaring the board array in each function, it is creating a local array that takes precedence, hiding the global array. This is not the same array as the global array. Once the function ends, the local array no longer exists and the global array is once again present and available for use. You need to use the global array, not a local shadow.
My best guess as to why you are getting partial success is that the two functions just happen to be using some or all of the same memory for the shadow arrays, but intermediate processing is also briefly using some of that memory, changing the contents. But this is just an educated guess. ;-)
If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)