Flexible array member in C-structure

The C FAQ answers precisely this question. The quick answer is that this structure will include the double array inside the structure rather than a pointer to an array outside the structure. As a quick example, you could use your structure as in this example: struct s mystruct = malloc(sizeof(struct s) + 5 * sizeof(double)); … Read more

Array of zero length

Yes this is a C-Hack. To create an array of any length: struct someData* mallocSomeData(int size) { struct someData* result = (struct someData*)malloc(sizeof(struct someData) + size * sizeof(BYTE)); if (result) { result->nData = size; } return result; } Now you have an object of someData with an array of a specified length.