Lets say I do
char *a;
a = new char[4];
Now, is it possible to extend the size of the array further?
Say I want to keep any values I put inside a[0]
to a[3]
but now I want more space for a[4]
and a[5]
etc. Is that possible in C++?
At first I felt like maybe I could just make:
char* a[10];
a[0] = new char[size];
Whenever more space is needed I can go to a[1]
and allocate more space. This is the only alternative I can think of at the moment.