[comp.lang.c] Help needed: 2D arrays and pointers in ANSI C.

lim@ecs.umass.edu (12/02/90)

Hi,

I'd appreciate any answers you may have to the following problem. It's about 2D 
arrays and pointers in ANSI C.

Suppose I have:

int main(void)
{
 void   test_matrix(double **matrix);
 double **matrix;

 matrix = (double **) calloc(100,sizeof(double));
 test_matrix(matrix);
}

test_matrix(**matrix)
{
 int i,j;

 .
 .
 .
}

I'm aware that it's possible to use just pointers (*) to access the array, but 
have had no luck trying to use something like matrix[i][j] in the test_matrix 
function. Is it possible to use matrix[i][j] at all? I've had no problem using 
matrix[i] for a *matrix argument (1D array).

Thanks in advance.


Jonathan Lim