-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2d_array.c
More file actions
38 lines (34 loc) · 836 Bytes
/
2d_array.c
File metadata and controls
38 lines (34 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <stdio.h>
//define 8x8 chess board
char board [8][8] = {
{'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O'},
{'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O'},
{'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O'},
{'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O'},
{'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O'},
{'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O'},
{'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O'},
{'O', 'O', 'O', 'O', 'O', 'O', 'O', 'O'}
};
int row;
int column;
//method to print chess board
void print_board()
{
printf("\n");
//loop over each element and print it
for (row=0; row<8; row++)
{
for (column=0; column<8; column++)
{
printf("%c ", board[row][column]);
}
printf("\n");
}
printf("\n");
}
int main(int argc, char **argv)
{
//call print_board method
print_board();
}