previous | index | next

Static vs. Dynamic Arrays

Sometimes, however, it is not known until run time how large an array should be:
  int n;
  cout << "How large should the array be? ";
  cin >> n;
Now:
  int v[n];
will not work because it is processed by the compiler, and n is not known until run time.


previous | index | next