Pb with passing a row of a matrix to a function

olivier at alpo.colorado.edu olivier at alpo.colorado.edu
Fri Apr 13 04:31:23 AEST 1990

I am trying to write a function which takes as argument
a pointer to a row of a matrix:

f(row, dim)
int *row;
		stuff with row[j]; ...

where f is called as f(&matrix[i]) and 
matrix has been declared as two-dimensional 
(int **matrix , calloc-ed and initialized)
In other words, I'd like row[j] to  be equal to  matrix[i][j];
This doesn't work because, in f, row points to matrix[i] which is a pointer
to an int (matrix[i][0]), and not an int. I can't do the extra redirection in f,
though.  Any hints on what I could do, or is there something wrong in my 

Olivier Brousse                       |
Department of Computer Science        |  olivier at boulder.colorado.EDU
Institute of Cognitive Science        |
U. of Colorado, Boulder               |

More information about the Comp.lang.c mailing list