Hello
I have older c functions which I want invoke in new cpp program:
// Example of old c function
void c_function(int** x, int r, int c)
{ int i, j;
for (i = 0; i < r; i++)
{
for (j=0; j<c;i++)
printf("%i ", *(*(x+i)+j));
printf("\n");
}
}
// my cpp program, where I would like to invoke c_function
int main(int argc, char *argv[])
{
int r=3, c=2,
x[3][2] =
{
{00, 01},
{10, 11},
{20, 21}
};
c_function(x, r, c);
return 0;
}
This does not work. Error in line c_function(x, r, c):
Conversion of first parameter from 'int [3][2]' to 'int **' impossible. (Sorry, no good translation of foreign language message.)
Question: Is it possible to cast 'int [3][2]' to 'int **' ?
I don't like to use ** pointer in cpp program when [][] for two dimensional arrays is possible.
Thanks a lot for your advice.
yap