For example, I have an array with dynamic size based on user input:
int n;
cin >> n;
int items[n];
Is this array allocated on stack? Or is it on heap like if I have written:
int n, *items;
cin >> n;
items = new int[n];
...
delete [] items;
Edit: I understand what the second code does. I'm asking whether the first code does the same thing like the second, but with less amount of lines.