Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!snorkelwacker!spdcc!ima!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Passing Multi-dimensional arrays to a function Message-ID: <17114@haddock.ima.isc.com> Date: 18 Jul 90 19:38:56 GMT References: <1990Jul17.224910.20086@DRD.Com> <9905@crdgw1.crd.ge.com> Reply-To: karl@kelp.ima.isc.com (Karl Heuer) Distribution: na Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 15 In article <9905@crdgw1.crd.ge.com> volpe@underdog.crd.ge.com (Christopher R Volpe) writes: >In article <1990Jul17.224910.20086@DRD.Com>, tdh@DRD.Com (Tom Haynes) writes: >> char buf[SCREEN][COLS][MAX_SCREEN]; > >Beats me, buf is of type (char ***), and that's what the formal parameter >wants. No, it isn't. buf is of type `char[SCREEN][COLS][MAX_SCREEN]', which (being an array type) will decay into `char (*)[COLS][MAX_SCREEN]', i.e. pointer to array of array of char. If every object being passed through this parameter has type `char (*)[COLS][MAX_SCREEN]', then you can declare the parameter to have that type. Otherwise, your best bet is to allocate `buf' at runtime using dope vectors, so that it really does have type `char ***'. Karl W. Z. Heuer (karl@kelp.ima.isc.com or ima!kelp!karl), The Walking Lint