Two serious problems. First, you have declared board[d][d] inside of the init() function. This means that you're creating what's called a shadow of the global array board
. The shadow takes precedence locally inside the function. That means that you're populating the shadow array, not the global array. The shadow array ceases to exist when the init() function is exited, leaving the global array with all zeros.
Next, you're printing each array element, or tile, on a separate line because of where you placed the printf("\n");
statement. Since it is inside the inner for loop, it will execute with each tile printed. It needs to be placed... ooh, I almost gave it away..... somewhere else so that it only executes at the end of each row. ;-)
There may be other issues, but this will get you going.
If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)