Im trying to make a program that checks a suduko solution. Im having trouble though trying to pass a 2-d array into my functions. I know i have to use pointers but im not sure how...
the only errors im getting are
//this is where i get the error argument of type int is incompatible with type **int
bool SquareCheck (int *map, int i, int j);
int main(){
bool row, square;
int board[9][9]={7,6,1,5,8,2,4,9,3,4,9,5,7,3,6,2,1,8,8,3,2,4,9,1,6,5,7,1,4,9,3,2,5,8,7,6,2,7,3,1,6,8,5,4,9,6,5,8,9,4,7,1,3,2,9,1,6,2,5,3,7,8,4,3,8,7,6,1,4,9,2,5,5,2,4,8,7,9,3,6,1};
//int i,j;
//for(i=0;i<9;i++){
//cout<<"Enter row " << i+1 <<": "<< endl;
//for(j=0;j<9;j++){
//cin >> board [i][j];
//}
//}
row = RowCheck(**board); //this is where i get the error argument of type int is incompatable with type **int
//column = RowCheck(*board);
square = SquareCheck(*board, 1,1);
//for (int i=0; i<9; i++)
//{
//for (int j=0; j<9; j++)
//{
//cout << board[i][j] << " ";
//}
//cout << endl;
//}
if (square && row == true)
cout << "The soluion is valid.";
else
cout <<"There was an error.";
system("pause");
return 0;
}
bool RowCheck (int **map){
bool check;
for(int i=0; i<9;i++){
int sum =0;
for (int j=0; j<9; j++){
sum += map[i][j];
if(sum==45)
check=true;
else{
check = false;
cout<< "Row "<< i+1<< "is incorrect."<<endl;
}
}
}
return check;
}
bool SquareCheck (int *map, int i, int j){
int sum = 0;
bool check;
for(i ; i<4;i++){
for(j ;j<4;j++){
sum += map[i][j];
}
}
if(sum==45)
check=true;
else{
check = false;
}
return check;
}