I want to be able to dynamically create an array of strings. For example, I might want to create an array of state names. The number of states and string length are unknown until runtime. I'm aware I could accomplish this with a vector, but want to learn the c-like way of doing the same thing.
But here I'm specifying the length of the string to be 25, right?
No.
char* arr[25];
This creates an array of 25 char-pointers. Each of these 25 char-pointers is going to point to a string. You've limited yourself to 25 strings, but you've said nothing about the length of those strings.
Let's take this a step further. I do not want to specify a fixed size for the number of char pointers I create. This will be determined at runtime. Can I do this?
I'm trying to learn about dynamic arrays. I just don't want to initialize the array with a fixed size. I want the method to to be flexible enough that I don't have to hard code limits, etc.