For some reason, in the past, I recall not being able to do something like:
cin >> arraySize;
The C++ Standard does not support variable length arrays though some compilers can have their own language extensions that allow to use VLAs in a C++ program.
Thus this code snippet
int arraySize; cin >> arraySize; int array[arraySize];
is not C++ compliant.
Use instead the standard C++ class
As for C then according to the C Standard implementations may conditionally support VLAs.
You can check whether an implementation supports VLAs. From the C Standard (188.8.131.52 Conditional feature macros)
1 The following macro names are conditionally defined by the implementation:
The integer constant 1, intended to indicate that the implementation does not support variable length arrays or variably modified types.