- #1
Whovian
- 652
- 3
Code:
#include <iostream>
using namespace std;
int a;
int main()
{
cin >> a;
int c [a];
for (int i = 1;i!=a+1;i++)
{
c [i] = i;
}
for (int i = 1;i!=a+1;i++)
{
cout << c [i] << endl;
}
return 0;
}
This compiles and does exactly what it's supposed to. But wait, I thought you could only declare arrays with a constant number of elements?