More Pointers ...

Chris Torek torek at elf.ee.lbl.gov
Fri Mar 15 09:50:33 AEST 1991


In article <1991Mar13.161322.8214 at uunet.uu.net> karln!karln at uunet.uu.net
(Karl Nicholas) writes:
>	int Board[3][3];
>	init_board( Board );

>init_board ( Board )
>int (*Board)[3][3];

Someone else posted an incomplete followup that is likely to provoke all
sorts of noise.  The declaration in init_board here is incorrect; it
must be one of:

	int (*Board)[3];	/* I recommend this over all others. */

or:

	int Board[][3];

or:

	int Board[3][3];

You may get away with

	int Board[99][3];

or other bogus values in the first dimension, but I would advise against
it even if ANSI X3.159-1989 permits it (I do not know whether it does).

I recommend the first format because it is the least misleading.

See the Frequently Asked Questions for discussion as to why the first
declaration is correct.
-- 
In-Real-Life: Chris Torek, Lawrence Berkeley Lab EE div (+1 415 486 5427)
Berkeley, CA		Domain:	torek at ee.lbl.gov



More information about the Comp.lang.c mailing list