This code is supported by C99 language specification. This code is also supported by GCC compiler in C89/90 mode as an extension.
So, the answer to your question (why it "works") depends on how you are compiling it. In general case, this will not even compile by a C89/90 compiler.