I am trying to make some functions working on two dimensional arrays:
void display_matrix(int**, int, int);
void gen_matrix(int**, int, int);
int main()
{
srand(time(0));
int m=5, n=3;
int my_matrix[m][n];
gen_matrix(my_matrix, m, n);
display_matrix(my_matrix, m, n);
}
I don't know what's wrong, but I get the following error when I call the functions: [Error] cannot convert 'int ()[(((sizetype)(((ssizetype)n) + -1)) + 1)]' to 'int*' for argument '1' to 'void gen_matrix(int**, int, int)'
I know I can use vector but I am trying to practise and remember the use of pointers and arrays.
int**is not a two dimensional array. So, here's your problem.main(). Some vendors support it by extension, but it is not part of the standard. And if you're using them inmainis there some reason you decided not to use them in your parameter list?