Well, I assume the board was already declared as a global variable when you implemented
A global variable is typically used when you need more than one function in your source code file to access it (as it's the case here).
Global variables also can be accessed directly from the functions defined in the same source code files. For example, consider the following simple program
void incrementX(int i);
int x; // global variable
x = 5; // NOTICE that we're accessing x directly from main()
printf("Before incrementing:\nx: %d\n", getX()); // print the value of x
incrementX(10); // increment x by 10
printf("\nAfter incrementing:\nx: %d\n", getX()); // print the value of x
increments x by i
void incrementX(int i)
x = x + i; // NOTICE that we're accessing x directly from incrementX()
returns the value of x
return x; // NOTICE that we're accessing x directly from getX()
draw(), you'll need to print the 2D-array row by row and column by column. For example, in case of 3x3 array, it should be printed like that (regardless of the order)
1 2 3
4 5 6
7 8 _
I assume you didn't manually initialized the elements of that array when you implemented
init(), so FYI the process is very similar (you'll probably need to use loops to achieve that).
Also, don't forget to check for the value that represents the blank tile in your code so that you print it appropriately!
Lastly, you don't have to care about the values of the elements in this array being changed as the user makes moves since every time
draw() is called, it accesses the elements of this array and prints them no matter what their values are. You may refer to Zamyla's walkthrough on
draw() for more information!