I am trying to pass a 3x3 array by reference in C++. However when I do it I get the error error: cannot convert ‘double*’ to ‘double’ in initialization. I tried to follow the instructions given on this page. I have a for loop in there but I am not going to be using that until I can get the array to pass properly:
void transpose(double (&arr)[3][3] )
{
for (int counti = 0; counti < 3; counti++) {
for (int countj = 0; countj < 3; countj++) {
double i_swap = &arr[0][0];
}
}
}
int main()
{
double myarray[3][3] = {{1,2,3},{4,5,6},{7,8,9}};
transpose(myarray);
return 0;
}