On Jul 3, 2:52*pm, "hugo.arre...@gmail.com" <hugo.arre...@gmail.com>
wrote:
> > Forgetting the details of shared memory (which you would get better
> > advice in comp.unix.programmer, btw, as it is not standard C), you
> > could consider using the struct hack to solve your problem. *See, e.g..http://c-faq.com/struct/structhack.html
>
> > -David
>
> Thanks you David, but my problem is how to do that in shared memory, i
> will try in comp.unix.programmer.
>
> Thanks again.
The first option in the faq site should work as well with shared
memory as elsewhere as far as I know. i.e. put in your structure
this:
struct b arrayOfB[1];
But allocate enough space for the structure AND the desired number of
"b" elements, then use it. This avoids the problem of having a
pointer to another block of memory in the struct...
-David