Declaration Question

William Setzer IDM setzer at nssdcs.gsfc.nasa.gov
Wed Jul 26 08:34:43 AEST 1989


In article <1242 at atanasoff.cs.iastate.edu> hascall at atanasoff.cs.iastate.edu.UUCP (John Hascall) writes:
>In article <394> setzer at nssdcs (William Setzer (IDM)) writes:
>> [Stuff I said]
>   "char *foo[K][N]" is "array K of array N of pointer to char" which doesn't
>   match your picture, how about "char (*foo[K])[N]" which is "array K of
>   pointer to array N of char" which seems to match your picture
I thought that things adjacent to a name had priority over things farther
away, ie, '*foo[][]' = '(*(foo[]))[]'.  Oh well, I guess I'd better check
again.
>   and you will need to malloc the K sets of "N chars" yourself
Then that means that if you say 'char (*foo[K])[N]', then at best the
'[N]' part is lint fodder (no offense to lint intended).  What's the point?
--
William Setzer
setzer at epsl.umd.edu    ; My 'real' mail address



More information about the Comp.lang.c mailing list