C Language History – When Did Flexible Arrays Become Part of the Standard?

arraychistory

I learned to program in C many years ago, and used C steadily for about 10 years.

These days, I occasionally have to look at C code, because our Informix 4GL RDS customized runners also contain C code, but it is fairly simplistic code.

When I was using C a lot, I never remember hearing about of flexible arrays. I am asking this question, because I came across this SO question. Thanks.

Best Answer

It is defined in ISO C99; I don't really know if it has been defined before, but I doubt it.

Traditionally, structures with now-specified flexible arrays were declared with arrays of size 1 at the end, and then allocated according to the desired size, a trick known as the "struct hack". Examples of this may be seen eg. in the Windows API.