Appending strings to string array

Hello.

I make a project, and I need to hurry up 'cause tomorrow it has to be done.

I need to make a list (array) of strings that contains names of files from sd card. I have a code that reads all the names. I only have to make a array. How?

void printDirectory(File dir) {
  while (true) {
    File entry =  dir.openNextFile();
    if (! entry) {
      break;
    }

    //now entry.name means the name of currently opened file
    // how to make an array?
    entry.close();
  }
}