Okay dudes back for yet another semester of mind bending programming. Anyhow dudes I totally forgot something from last semester. I was just wondering if anyone out there could refresh my memory on how to build a structure with an array of entries.

Printable View

- 08-30-2004drdodirty2002structures
Okay dudes back for yet another semester of mind bending programming. Anyhow dudes I totally forgot something from last semester. I was just wondering if anyone out there could refresh my memory on how to build a structure with an array of entries.

- 08-30-2004quzahCode:
`struct foo`

{

int array[10];

} bar[10], *baz;

int x, y;

/* since I don't know exactly what you are stuck on... */

for( x = 0; x < 10; x++ )

for( y = 0; y < 10; y++ )

bar[x].array[y] = x * 10 + y;

/* and of course, via pointers... */

baz = bar;

for( x = 0; x < 10; x++, baz++ )

for( y = 0; y < 10; y++ )

baz->array[y] = x * 10 + y;

Quzah. - 08-30-2004kuphryn
Another solution is STL vector container.

Kuphryn