Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!ericom!eos.ericsson.se!epames From: epames@eos.ericsson.se (Michael Salmon) Newsgroups: comp.lang.c Subject: Re: prototyping (oh no! not again??) Message-ID: <1990Nov28.150510.12750@ericsson.se> Date: 28 Nov 90 15:05:10 GMT References: Sender: news@ericsson.se Reply-To: epames@eos.ericsson.se Distribution: comp Organization: Ericsson Telecom AB Lines: 22 In article John E. Davis writes: > double trace(double **matrix, int dim) ^^ this is pointer to pointer to double > { > int i; > double t; > > t = 0.0; > i = 0; > while(i++ < dim) t = t + matrix[i][i]; ^^ this is *(*(matrix + i) + i) > return t; > } I don't think your compiler should have allowed this as you were passing a pointer to a double not a pointer to a pointer to a double. What has happened is that the double at matrix[0][i] is treated as a pointer and dereferenced with an offset of i, not surprisingly you got an error. Michael Salmon L.M.Ericsson Stockholm