Array/ Pointer gives me an error

The program should ask the user how many students were surveyed and dynamically allocate an array of that size. The program should then allow the user to enter the number of movies each student has seen.

#include <iostream>
#include <string>
using namespace std;

int main()
{
int numStudents;
double *movies;

cout << "How many students were surveyed?" << endl;
cin >> numStudents;

while(numStudents <= -1)
{
cout << "Enter a positive number." << endl;
cin >> numStudents;
}
movies = [numStudents];

return 0;
}


The problem I'm having is that where I declare movies = [numStudents]; the semicolon after the numStudents array is giving me this error - "error: expected a '{' introducing a lambda body". I been stuck for a very long time and I have no clue why it's giving me this error.
Where's your new operator?

Should be something like:
1
2
3
4
5
movies = new double[numStudents];

// More code

delete[] movies;
thank you! it worked.
Topic archived. No new replies allowed.