You use local stack variable for the board, local variables will be deleted on leaving the function, should probably use a global variable. Not sure how d is passed, maxbe init has a parameter. Your single loop would output just the elements of the diagonale, needs nested loops just like when filling, and break leaves the current loop.
Blauelf
- 21k
- 2
- 13
- 22