Refering to the second link inmy post.
How would I use that formula in:
Code:
bool isMine (int row, int col, char board[][MAXSIDE])
{
if (board[row][col] == '*')
return (true);
else
return (false);
}
Since it is no for loop inside of this function?
Should I just let the function take in the index
as parameter and calculate the index using
i * x + j as an argument like this?
Code:
bool isMine (int index, char board[][MAXSIDE])
{
if (board[index] == '*')
return (true);
else
return (false);
}
Calling the function:
Code:
if (isMine (i * x + j, board)) {
// ...
}