Good morning to everyone, i know there is so many forms to pass an Array in to a function, and there are so many potst about this. But even reading this post i can not pass my array to the function. When I call the function on main, it appears an error as it shows on the following code.
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int row = 5;
int column=20;
void dimensions (int [20]);
int main (){
int *matriuprova[column];
for (int i= 0; i<column;i++){
matriuprova[i] = new int [row];
dimensions(matriuprova);// <-- here is the error:
//main.cpp:14:31: error: cannot convert 'int**' to 'int*'
//for argument '1' to 'void dimensions(int*)'
}//end of for loop
return 0;
}//end of main
void dimensions (int *matriuprova [20]){
//function code
}
I have followed this link: Passing a 2D array to a C++ function
Thanks to everyone!