I am learning C++ and I just read about dynamic arrays and how it lets you set the length of an array during runtime rather than during compile time. However, you don't need a dynamic array to do this. So what is the point of a dynamic array; when would you use it? I feel like I am missing something obvious so any insight is much appreciated. Thanks!
// Static binding.
int size = 0;
cout << "Enter size of array:" << endl;
cin >> size;
int array[size];
int array_length = sizeof(array) / sizeof(int);
cout << "Number of elements in array: " << array_length << endl;
// I just set the length of an array dynamically without using a dynamic array.
// So whats the point of a dynamic array then?