C pointers
Chris Calabrese[mav]
cjc at ulysses.homer.nj.att.com
Tue Feb 14 06:37:33 AEST 1989
In article <3374 at xyzzy.UUCP>, throopw at xyzzy.UUCP (Wayne A. Throop) writes:
| > jcrowe at shaffer.UUCP (Joe Crowe)
| > I have a structure which contains among
| > other things a pointer to an array of structures declared as follows:
| > typedef struct XYZ
| > { ...
| > struct diag_cmd (*p_cmd_blk)[];
| > ... } t_xyz;
| > I try various methods of accessing a structure member one of the array
| > of structures I am getting compiler errors. I have tried most combinations
| > but with no luck. Any ideas??
|
| Um.... maybe I'm being naive myself, but did you try the obvious one,
| the one you declared it with? That is,
|
| (*t_xyz.p_cmd_blk)[N]
Um...isn't (*p_cmd_blk)[] an array of pointers, not a pointer to an array?
try *(p_cmd_blk[]).
K&R (old) Page 110 says that int *b[10] is an array of 10 pointers to int;
therefore, struct diag_cmd *p_cmd_blk[] should be an array of pointers to
struct diag_cmd. Somehow I doubt that the parens around *p_cmd_blk are
grouping things differently.
Ayway, there's always struct diag_cmd **p_cmnd_blk.
--
Name: Christopher J. Calabrese
Brain loaned to: AT&T Bell Laboratories, Murray Hill, NJ
att!ulysses!cjc cjc at ulysses.att.com
Obligatory Quote: ``Now, where DID I put that bagel?''
More information about the Comp.lang.c
mailing list