How to declare dinamic size String Array?

#include <ESPFlashString.h>

int si[12];
ESPFlash<int> sif("/si");
bool success_si = sif.getFrontElements(si, sizeof(si));

const int ArraySize = si[0];

String data[ArraySize];


setup {

  data[4] = "blablabla";

}

How can it be solved?
Thanks!

Solved what?

Please make favour to yourself and read the guide How to get the best out of this forum, which will inform you about a correct way to asking a questions on this forum.


String *data = new String[ArraySize];

Fine working.
Thank you very much!

hopefully you put that in a function and String *data; is a global variable

A new without delete is asking for trouble....
Unless it is a global and it is done only once (but what is dynamic then?).
You can also use the vector library...

It’s only known at run time, read from storage.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.