Only C supports variable length arrays, C++ doesn't. C++ standard says that the size of the array must be a constant expression.
Use std::vector
instead. Declaration should be
void mark(int n, int m, int i, int j, vector< vector<int> > &canvisit, vector< vector<int> > &a);