This will not work in standard C++ because the size of the array has to be a compile time constant. Some compilers (e.g. GCC/MinGW) allows this as an extension to the langauge so I guess it depends on if you want to depend on certain compilers or if you only want to write standard C++.
Another problem could be if the array is too big. The stack is usually not as big as the heap so you are more limited in space than if you had dynamically allocated the array, using new or std::vector.
In C99, this would compile. It will be safe if the array is small enough (typically, can fit in the stack); otherwise there would be undefined behaviour.
In conforming C++, this won't compile cleanly; the size of an array must be a constant known at compile time.