I am working on a minesweeper game in a console and would like to know how I can modify an array value using a function?
I have a global char table[10][10];
but it can't be global and I need to change the size to what a user wants when starting the program. Also I need to modify the table
value in this function:
int findnearbymines(int row, int col) {
int mines = 0;
if(table[row - 1][col] == '*')
mines++;
if(table[row + 1][col] == '*')
mines++;
if(table[row][col - 1] == '*')
mines++;
if(table[row][col + 1] == '*')
mines++;
if(table[row - 1][col + 1] == '*')
mines++;
if(table[row - 1][col - 1] == '*')
mines++;
if(table[row + 1][col + 1] == '*')
mines++;
if(table[row + 1][col - 1] == '*')
mines++;
return mines;
}