From owner-freebsd-questions Thu Aug 9 12:32:41 2001 Delivered-To: freebsd-questions@freebsd.org Received: from cactus.fi.uba.ar (cactus.fi.uba.ar [157.92.49.108]) by hub.freebsd.org (Postfix) with ESMTP id EBFFE37B405 for ; Thu, 9 Aug 2001 12:32:32 -0700 (PDT) (envelope-from fgleiser@cactus.fi.uba.ar) Received: from cactus.fi.uba.ar (cactus.fi.uba.ar [157.92.49.108]) by cactus.fi.uba.ar (8.11.3/8.9.3) with ESMTP id f79JT4i76060; Thu, 9 Aug 2001 16:29:05 -0300 (ART) (envelope-from fgleiser@cactus.fi.uba.ar) Date: Thu, 9 Aug 2001 16:29:04 -0300 (ART) From: Fernando Gleiser To: "Hays, Sam" Cc: "'freebsd-questions@freebsd.org'" Subject: Re: Goofy programming question ( C ) In-Reply-To: Message-ID: <20010809160227.I71785-100000@cactus.fi.uba.ar> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Thu, 9 Aug 2001, Hays, Sam wrote: > > the question: > Passing a two dimensional array to a function via a pointer. > > what I have is this: > void function(char* array); > . . . > char array[4][4]; > function(array); > . . . function expects an char * as an argument. array is not a char *. change the prototype to void function (char array[][4]). > > that doesn't work. I've tried a whole slew of other things, anybody have > any suggestions? Yes, read chapter 5 of K&R ("pointers and arrays"). Look for the section about multidimensional arrays. Fer > > -SH > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message