This is a valid C99 function called variable length arrays (VLA), if you compile with gcc -std=c90 -pedantic , you will get the following warning:
warning: ISO C90 prohibits an array of variable length arrays [-Wvla]
using -std=c99 -pedantic will not give a warning, although both gcc and clang support VLA outside of C99 mode, as well as in C ++, which does not allow VLA as an extension .
Of Visual Studio does not support VLA , even if they now support C99
source share