Code:
for (int j=0; j < BoardSize; j++);
{
MakePlay (i,j);
}
The semicolon I've indicated in red will make the code do really bad things. In essence it's the entire body of the for loop, and the curly braces that follow are a random block that you've introduced. So what will happen is that the for loop will execute as you programmed it to, do nothing each time, and then the code in the block will execute once (with j == BoardSize, which will probably crash it!). Or it would if j existed outside of the loop; since it doesn't, you're getting that error message. The short of it is that you should get rid of that semicolon.
You're also trying to pass a single integer as an array of ints to your MakePlay function. That's not going to work. Maybe you could start by looking at some code like this:
Code:
/* This is C, not C++. */
#include <stdio.h>
#define WIDTH 40
#define HEIGHT 20
/** When you pass an array to a function, you must specify all but the leftmost
dimension.
*/
void init_board(char board[][HEIGHT]);
void print_board(char board[][HEIGHT]);
int main() {
char board[WIDTH][HEIGHT];
init_board(board);
print_board(board);
return 0;
}
void init_board(char board[][HEIGHT]) {
int x, y; /* declaring variables inside for loops isn't C89 */
for(y = 0; y < HEIGHT; y ++) {
for(x = 0; x < WIDTH; x ++) {
board[x][y] = '-';
}
}
}
void print_board(char board[][HEIGHT]) {
int x, y; /* declaring variables inside for loops isn't C89 */
for(y = 0; y < HEIGHT; y ++) {
for(x = 0; x < WIDTH; x ++) {
printf("%c", board[x][y]);
}
printf("\n");
}
}
That's just some code I whipped up that doesn't do anything very interesting, but it at least shows you the syntax for passing arrays to functions and accessing array indices.