I am getting this error while running the code:
[Error] array bound is not an integer constant before ']' token
Here is a segment of the code:
using namespace std;
int R,C;
bool isSafer(int grid[][C],int row,int col, bool visited[][C])
{
if(row<R && row>=0 && col<C && col>=0 && grid[row][col] && visited[row][col])
{
return true;
}
return false;
}
int main()
{
....
....
cin>>R>>C;
int grid[R][C];
....
}
In int main() I ask user for the input for R and C. I have also declared the array in the main function and called in in the above mentioned function. Please suggest me how should I pass my array to the function with the parameter as variable taken by the user.