Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!ncar!boulder!alpo!olivier From: olivier@alpo.colorado.edu Newsgroups: comp.lang.c Subject: Pb with passing a row of a matrix to a function Message-ID: <19604@boulder.Colorado.EDU> Date: 12 Apr 90 18:31:23 GMT Sender: news@boulder.Colorado.EDU Reply-To: olivier@alpo.colorado.edu () Organization: University of Colorado, Boulder Lines: 25 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 reasoning? Thanks, Olivier Olivier Brousse | Department of Computer Science | olivier@boulder.colorado.EDU Institute of Cognitive Science | U. of Colorado, Boulder |