Both examples contain an error, by the way.
You must declare an automatic array with a size that is a constant known at compile-time.
The second example compiles, but is also wrong. You have to delete an array that was created with new[] using delete[].
Another difference is that the first allocates memory on the stack while the second does it on the heap. Also, the first is not standard c++ code. Not all compilers support it.
Thanks all! The thing is that they both compile and run exactly the same way, which is why I asked in the first place. I find this weird, now that I've read your comments, but it's true nevertheless.
It's "officially" allowed to do that in C since the C99 standard, so it is no longer an extension for C...
but for C++ it remains an extension and so it might not work with other compilers (most notably VC++, which is a popular compiler in Windows environments).