Why won't this code compile?

#include<iostream>

int main()
{
int length;
std::cout << “\nPlease key in the length of your array”;
std::cin >> length;
int array[length];
return 0;
}


Thanks!

-O
Array size has to be known at compile time i think
Itd be nice if you gave the error and used code tags
You need to include " using namespace std; " before the main function and you need to declare the array before you refer to it.
closed account (o1vk4iN6)
You need to include " using namespace std; " before the main function


That is not needed.
Array size has to be known at compile time i think


This is the issue.
It's not about the array.
Pasting the code to C::B gave a lot of errors related to characters encoding. I think they are the quotes and semicolons
Topic archived. No new replies allowed.