Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!tut.cis.ohio-state.edu!attctc!bobc From: bobc@attctc.DALLAS.TX.US (Bob Calbridge) Newsgroups: comp.lang.c Subject: Need help with array of pointers to structure Keywords: HELP Message-ID: <8587@attctc.DALLAS.TX.US> Date: 8 Jul 89 23:43:34 GMT Distribution: na Organization: The Unix(R) Connection, Dallas, Texas Lines: 36 I could sure use a hand (or some talented fingers.) Here is the situation. I have a structure defined which includes some pointers, counters and a buffer. I also have an array of pointers to twelve of these structures. As an example, if I want to clear each of the buffers and set a pointer to the beginning of the buffer plus set a counter to zero, I need to know how to address and manipulate the elements of the structure. I thought I understood the mechanism but I keep getting error messages from the compiler. Here is basically what I thought was proper. vtable is define as struct *vtable [] = {&v1, &v2, &v3,......v12}; I was trying to do something like this: for (i=0; i < 12; i++) { vtable[i]->ptr = vtable[i]->buf; for (j=0; j<80; j++) vtable[i]->*ptr = -1; } where the intent is to place -1 into the 80 positions of the buffer and to do this for each of the 12 structures. Can anyone tell me what I'm doing wrong or if there is a better way. Even if there is a better way, I'd like to know what my misunderstanding is here. Please use e-mail if you could, I'm way behind on reading this group. Thanks (for;ever;) Bob -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- = I know it's petty.......... = - But I have to justify my salary! - =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=