I am trying the following code for multi-dimensional array. It gives SEG
error
I do not know what is the issue in this.
static void read(double **arr){
//REQ arr to be pointing to array[5][4]
//EFF prompt the use to input the data
//Mod array pointer by **arr
int i(0) , j(0);
double tmp ;
for(i=0 ; i<4 ; i++){
for(j=0 ; j<5 ; j++) {
cout <<"Please enter Data#"<< (j+1) << " File#" << (i+1) <<" "<<flush;
cin >> tmp ;
arr[j][i] = tmp ;
}
}
return ;
}
int main(){
double arr[5][4] ;
read(reinterpret_cast<double**>(arr) ) ;
}
What am i doing wrong here?