14 May
2013
14 May
'13
6:52 a.m.
Sorry if this is OT and a dumb question, but are you sure you want On Mon, May 13, 2013 at 8:20 PM, LANGLOIS Olivier PIS -EXT <olivier.pis.langlois@transport.alstom.com> wrote: [...]
struct B { int numelem; /* * Old C trick to define a dynamically sizable array just by allocating * sizeof(B) + (numelem-1)*sizeof(A) memory. */ A item[1]; };
one item vs.
void initArr(B *p);
lano1106@hpmini ~/dev/gcc-test $ cat test1_init.cpp #include "test1.h"
void initArr(B *p) { p->numelem = 2; p->item[0].a = 1; p->item[1].a = 2; }
two items? cheers! mar77i