Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!mailrus!iuvax!rutgers!mcnc!rti!xyzzy!throopw From: throopw@xyzzy.UUCP (Wayne A. Throop) Newsgroups: comp.lang.c Subject: Re: C pointers Message-ID: <3374@xyzzy.UUCP> Date: 13 Feb 89 15:26:57 GMT References: <1707@shaffer.UUCP> Organization: Data General, RTP NC. Lines: 48 > jcrowe@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] "It works for me." In particular, I did this: $ cc -g -o t46 t46.c $ mxdb t46 Scanning executable file... (debug) view 1 #include 2 struct diag_cmd { int i }; 3 struct { struct diag_cmd (*p_cmd_blk)[]; } t_xyz; 4 main(){ * 5 t_xyz.p_cmd_blk = (struct diag_cmd (*)[])malloc(4); 6 (*t_xyz.p_cmd_blk)[0].i = 23; 7 } (debug) breakpoint 7;continue Stopped at frame 1: line 7 of \t46\main, PC main+024 breakpoint "0" taken (debug) evaluate (*t_xyz.p_cmd_blk)[0].i 23 (debug) describe t_xyz struct { struct { int i; } (*p_cmd_blk)[]; } t_xyz; (debug) bye -- The seeds of crime bear bitter fruit. --- Dick Tracy -- Wayne Throop !mcnc!rti!xyzzy!throopw