I'm new to programming with C++, so this is fairly confusing. I'm trying to make an array of pointers, and it's not going real well.
I have an array of characters around 500,000 elements in size. I'm trying to make an array of pointers that then points to each of those different elements.
Take for example the string "abcdefg". I'm trying to construct a pointer array that would essentially point to each letter individually and allow me to print out the string like this:
a
ab
abc
abcd
abcde
abcdef
abcdefg
Here's what I was trying, and it doesn't seem to work:
for (int i = 0; i < strlen(strArray); i++, ptr++)
ptr = &strArray;
Any help would be greatly appreciated.
-Jon
I have an array of characters around 500,000 elements in size. I'm trying to make an array of pointers that then points to each of those different elements.
Take for example the string "abcdefg". I'm trying to construct a pointer array that would essentially point to each letter individually and allow me to print out the string like this:
a
ab
abc
abcd
abcde
abcdef
abcdefg
Here's what I was trying, and it doesn't seem to work:
for (int i = 0; i < strlen(strArray); i++, ptr++)
ptr = &strArray;
Any help would be greatly appreciated.
-Jon