Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site umcp-cs.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!umcp-cs!chris From: chris@umcp-cs.UUCP (Chris Torek) Newsgroups: net.lang.c Subject: Re: Casting for a fish that never arrived Message-ID: <5711@umcp-cs.UUCP> Date: Mon, 13-May-85 20:00:46 EDT Article-I.D.: umcp-cs.5711 Posted: Mon May 13 20:00:46 1985 Date-Received: Thu, 16-May-85 03:49:57 EDT References: <864@aplvax.UUCP> Organization: U of Maryland, Computer Science Dept., College Park, MD Lines: 27 Your second example works because Words is (correctly) a pointer to an array 4 of pointer to char (in cdecl syntax). You don't even need the casts in the assignment statements. If you want to do it without typedefs, try char *Cwords[2][4] = {{"1", "2", "3", "4"}, {"a", "b", "c", "d"}}; char *Pwords[2][4] = {{"w", "x", "y", "z"}, {"9", "8", "7", "6"}}; char *(*Words)[4]; main() { register int i, j; Words = Cwords; for (i = 0; i < 2; i++) for (j = 0; j < 4; j++) printf("%s\n", Words[i][j]); Words = Pwords; for (i = 0; i < 2; i++) for (j = 0; j < 4; j++) printf("%s\n", Words[i][j]); } -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 4251) UUCP: seismo!umcp-cs!chris CSNet: chris@umcp-cs ARPA: chris@maryland