I'm using MinGW to compile for C++11 and I found out that this doesn't throw an error:
int S; cin>>S; char array[S];
While this does ("storage size of 'array' isn't known"):
To me, the size is also unknown in the first case, as it depends on what the user input is.
As far as I knew, automatic arrays are allocated at compile time in stack memory. So why wouldn't the first example fail?
It's not. C++ doesn't have variable-length arrays, though some compilers allow it as an extension of the language.