Possible Duplicate:
passing 2D array to function
My question is related to passing an array as a C++ function argument. Let me show the example first:
void fun(double (*projective)[3])
{
for(int i=0; i<3; i++)
for(int j=0; j<3; j++)
{
projective[i][j]= i*100+j;
}
}
int main()
{
double projective[3][3];
fun(projective);
for(int i=0; i<3; i++)
{
cout<<endl;
for(int j=0; j<3; j++)
cout<<projective[i][j]<<" ";
}
return 0;
}
In the example, the passing argument for fun
is an array, and I was wondering whether there are other ways of passing this argument. Thanks!