No problem. :p
Type: Posts; User: antred
No problem. :p
Yep, which is exactly what it says in the comment above the reserve() call. ;)
Yes, but note that in my example I push_back() after I reserve().
Not just some other ways. Use a vector:
#include <iostream>
#include <vector>
#include <cstdlib>
#include <ctime>
#include <stdexcept>
Arrays don't work like that in C++. The size of an array must be known at compile time. You cannot change the size of an array at runtime like you're attempting to do.
If you need dynamically...