trying pass 2d array through function and output adjusted array

This isn't complete code I just wanted to simplified to get to point of whatever I'm having a problem. I can compile but it won't pass the values through he function inverse. So I can get the right inverse matrices inside the function but it doesn't return anything or I can't get it to work at all.

I believe the main program is trying to assign inverse(projection1) to invmatrix1
I just get redirection error or get pass float to float.

float inverse( float A[][3])
}
A[][]...does the computation changes to X[][]
return X[3][3];
}


int main (int argc, char** argv)
{


float invmatrix1[3][3];
float invmatrix1 = inverse(projection1);
float homography21[3][3];

for(i=0; i<m; i++)
for(j=0; j<m; j++)
{
homography21[3][3] = 0;
for(k=0; k<c; k++)
// same as z[i][j] = z[i][j] + x[i][k] * y[k][j];

homography21[i][j] += projection2[i][k] * invmatrix1[i][k];
}

for (i=0; i<m; i++)
{
cout<<"\n";
for(j=0; j<m; j++)
// display the result...
cout<<" "<<homography21[i][j];
}
}
Last edited on
you are returning the number that is 4 places beyond the last value defined in the array, so, yea, it's wrong! Try returning the first value instead. Also note that that plagram will not only change the array A, but also prijection1, becouse of pass-by-pointer
Topic archived. No new replies allowed.