I've noticed that this code:
#include <iostream>
using namespace std;
int main () {
int k;
cin >> k;
int n[k];
for (int i = 0; i < k; i++)
n[i] = i;
for (int i = 0; i < k; i++)
cout << n[i] << " ";
return 0;
}
compiles just fine. Could anyone clarify on this, because as far as I'm aware, static arrays must have a constant as their size.