Question about String
Posted: Mon Mar 11, 2024 11:06 pm
Hello, i am using arduino ide to program an esp8266 wemos d1 mini. I know using String is generaly not adviced due to memory leakage but i have a simple question about it regardless.
Let's say i have globably declared an array of strings:
Then in a loop i first init this array of Strings to "0":
After that, my program will try to read text from external server and if it connects, it will fill that array with text, such as:
My question is whether this is allowed, meaning i first init the string array, then write to it only "0" and then writing a long text into it. Is the size of String's in the array being increased beforehand to accommodate bigger string i am writing into it, or am i writting to memory outside of that array ?
Let's say i have globably declared an array of strings:
Code: Select all
String payload2D[40];
Code: Select all
for(int i=0;i<40;i++) payload2D[i] = "0";
Code: Select all
payload2D[0] = "DHT22_BOTTOM_1_Temperature: 27.3C"