0

I found this line defined in a structure in a C source code

unsigned char data[0];

Is it a buffer with unlimeted length? is it supported in the C89 or only in C99?

MOHAMED
  • 41,599
  • 58
  • 163
  • 268
  • It's a hack for variable-sized structures. And indeed a duplicate - at least 3 such questions have been asked already. – user4520 May 16 '15 at 17:10
  • You put it at the end of a structure with an unknown size, and then you can allocate instances of that structure with different sizes, and use this field (`data`) in order to access the additional piece of memory that has been allocated to each instance. – barak manos May 16 '15 at 17:10

0 Answers0