Actually its an old C trick for defining structs that have a variable amount of data appended to their header:
1 2 3 4 5 6 7
struct header
{
int data_size;
char type;
int id;
char data[0];
};
This allows you to index data that comes after the struct header like this:
1 2 3 4
// The zero sized dimension ensures the sizeof(struct header) does not include any data
struct header* h = (struct header*) malloc(sizeof(struct header) + data_size);
h.data[24] = 'x'; // Now write data beyond the end of the header.
I always assumed it was legal. Now I think that you should leave the dimension blank:
1 2 3 4 5 6 7
struct header
{
int data_size;
char type;
int id;
char data[]; // no size specified
};