Hi everyone.
I'm having trouble trying to write a function that takes a two dimensional array as an argument. I want to take a 10 x 10 matrix, and initialise it, so that each element is a '*'.
I pass an array, that is part of a struct. I'm using the function call:
initialiseBoard(p1.bombBoard);
where p1 is the struct, and bombBoard is the 10 x 10 array in the struct.
this is my code
Code:
void initialiseBoard(char *board);
.......
void initialiseBoard(char *board)
{
for(int j= 0; j < 10; j++)
{
for(int k = 0; k < 10; k++)
{
*board[j][k] = '*';
}
}
}
I can't get it to compile. I'm making a mistake with the pointers, I think. Could someone point me in the right direction?
Thanks in advance,
Justin