Print out 2d Array

Hey guys, I have a very simple question. I am trying to execute a very simple code but I can't seem to figure out why it isn't printing anything. Here's my code:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
void InitialGameBoard()
//////////////////////////////////////////////////////
// This will display the initial game board as well //
// That is, a board that is empty and ready for new //
// game play.									    //
//////////////////////////////////////////////////////
{
	int i, j;
	char Board[3][3];
	i = 0;
	j = 0;

	for(i = 0; i < 3; i++)
	{
		for(j = 0; j < 3; j++)
		{
			Board[i][j] = ' M ';
			cout << Board[i][j] << endl;
		}
		cout << endl;
	}
}
@georgieboy

A char is a single character, so when you try putting ' M ' into Board[i][j], only the first part is entered, which is a blank space. Try using 'M', without the space on each side. Should work okay, that way.
LMAO DUH!!

Thanks, I can't believe I didn't see that!
Topic archived. No new replies allowed.