I'm needing to be able to declare an array of type String, without knowing before hand how many strings (in this case, file names from an SD Card) there will be to place in it.
I had hoped the below would work:
String strAr[];
strAr[0] = "This is a test";
strAr[1] = "this is another test";
strAr[2] = "This is a third";
Serial.println(strAr[0]);
Serial.println(strAr[1]);
Serial.println(strAr[2]);
But the first line give the error message:
"storage size of 'strAr' isn't known"
What syntax can I use to add more cells to a String array?
The second linked page will give you all the possible ways to declare/initialise an array.
If you declare the array without initialising it, you can use strcpy() to initialise it.
Once you have the array initialised, you can use strcat() to add to it.
When I was using three Uno's (with Atmega328 chips) -- linked together with "SoftwareSerial" -- memory was far to precious to waste on real Strings. Everything was done instead with char arrays to conserve space. But now that I've converted the project to a single (but much bigger) Atmega1284 chip, memory use by real Strings is no longer an issue.