Casting for a fish that never arrived

Doug Gwyn <gwyn> gwyn at brl-tgr.ARPA
Tue May 14 12:03:16 AEST 1985


> char *Cwords[2][4] = {
> 	{"hello","go","here","see"},
> 	{"goodbye","come","there","hear"} 
> };
> char *Pwords[2][4] = {
> 	{"foo","foo","foo","foo"},
> 	{"foobar","foobar","foobar","foobar"} 
> };
> char *Words;
char *(*Words)[4];	/* after all, you want Words[i][j] to be a (char *) */
> 
> main()
> {
> 	int i,j;
> 
> 	Words = (char *)Cwords;
	Words = Cwords;
> 	for (i=0; i<2; i++)
> 		for (j=0; j<2; j++)
> 			printf("%s\n",(CASTING EXPRESSION)Words[i][j]);
			printf("%s\n",Words[i][j]);
> 	Words = (char *)Pwords;
	Words = Pwords;
> 	for (i=0; i<2; i++)
> 		for (j=0; j<2; j++)
> 			printf("%s\n",(CASTING EXPRESSION)Words[i][j]);
			printf("%s\n",Words[i][j]);
> }



More information about the Comp.lang.c mailing list