Writing Directly into the address of an 2D array?

Hey guys,

I am writing a function which has the following form:

1
2
3
4
5
6
7
8
9
10
void myfunction(double inputArray[9], double outputMatrix[3][3])
{
  for(int i=0; i<3; i++)
  {
    for(int j=0;j<3;j++)
    {
      outputMatrix[i][j]=inputArray[3*i+j];
    }
  }
}


what I am doing is that I am coverting an array of 9 doubles into a 2D 3x3 Matrix.

However, when I am preparing the output matrix, I want to write directly into the memory (so I won't lose the value after the call of the function).
I know for a simple variable, I can simply put a "&" (ex: double &oValue). What should I do in the case of an array?


Thanks in advance!

You can use pointers
eg:
void myfunction(double *inputArray, double **outputMatrix)
Topic archived. No new replies allowed.