Multi-dimensional Array Initialization [C++] (25)

16 Name: #!/usr/bin/anonymous : 2007-11-01 13:26 ID:xnFkfGcc

>>7
x[y]->z is perfectly valid.

Assume x is an array of pointers to structs of type **x.

We have:

struct foo { int z; };
/* ... */
struct foo *x[10];
size_t y = 0;
int bar;
x[y] = malloc(sizeof **x);
if(x[y])
bar = x[y]->z = 0;
free(x[y]);
This thread has been closed. You cannot post in this thread any longer.