When I type:
int n;
cin >> n;
int a[n];
It works on VS code but doesn't work on Visual Studio.
I expected it not to work at all because of memory-related stuff.
So, any explanation why it does work on VS code ?
When I type:
int n;
cin >> n;
int a[n];
It works on VS code but doesn't work on Visual Studio.
I expected it not to work at all because of memory-related stuff.
So, any explanation why it does work on VS code ?
a[n]
is variable-length array (VLA) which is a C99 feature. It is not a C++ feature. Some C++ compilers, never the less, accept the syntax as a compiler extension.