vault backup: 2024-10-08 22:11:53
This commit is contained in:
@ -53,4 +53,17 @@ char chess_board[8][8] = {
|
||||
```
|
||||
|
||||
|
||||
> 11. Write a program fragment that declares an 8x8 `char` array named `checker_board` and then uses a loop to store the following data into the array (one character per array element).
|
||||
> 11. Write a program fragment that declares an 8x8 `char` array named `checker_board` and then uses a loop to store the following data into the array (one character per array element).
|
||||
|
||||
```c
|
||||
char checker_board[8][8];
|
||||
for (int row = 0; row < 8; row++) {
|
||||
for (int column = 0; column < 8; column++) {
|
||||
if ((column + row) % 2 == 0) {
|
||||
checker_board[row][column] = 'B';
|
||||
} else {
|
||||
checker_board[row][column] = 'R';
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
Reference in New Issue
Block a user