syntax help

Roy Johnson rjohnson at shell.com
Fri Mar 22 02:03:40 AEST 1991


In article <WAYNE.91Mar20115318 at robyn.cs.odu.edu> wayne at cs.odu.edu (C Wayne Huling) writes:
> I keep getting errors from this, I don't understand the structure used
> for namelist??  How do I access this?  I keep getting:

> "t.c", line 14: warning: struct/union or struct/union pointer required
> [...]
>   struct direct *(*namelist[100]);
> [...]
>	printf("%s\n",namelist[i]->d_name);

namelist is array of pointers to pointers to struct direct, but you
are accessing it as if it's array of pointers to struct.  One more
level of indirection:
	printf("%s\n",(*namelist[i])->d_name);
should do it.

This post valid unless superceded by a post by Chris Torek, Doug Gwyn, or
Karl Heuer (where is he, anyway?), or other comp.lang.c gurus.
--
======= !{sun,psuvax1,bcm,rice,decwrl,cs.utexas.edu}!shell!rjohnson =======
Feel free to correct me, but don't preface your correction with "BZZT!"
Roy Johnson, Shell Development Company



More information about the Comp.lang.c mailing list