How do I pass the m matrix to foo()? if I am not allowed to change the code or the prototype of foo()?
void foo(float **pm)
{
int i,j;
for (i = 0; i
If you can't change foo(), you will need to change m. Declare it as float **m, and allocate the memory appropriately. Then call foo(). Something like:
float **m = malloc(4 * sizeof(float *));
int i, j;
for (i = 0; i < 4; i++)
{
m[i] = malloc(4 * sizeof(float));
for (j = 0; j < 4; j++)
{
m[i][j] = i + j;
}
}
Don't forget to free() afterwards!