Is there a way to declare an arrays’ size with a variable? language: C++

  arrays, c++, compiler-errors

I want to learn if there is a way to declare an array’s size using a variable. It gives an error when I try to do it. For instance here is an example:

#include <iostream>
using namespace std;
int main()
    int x;
    cin >> x;
    int list[x];

I want to do it because I want the user to decide the array’s size.
If there is a way to do it, can you teach me?
thanks in advance…

Source: Windows Questions C++