You will note that the String characters are not counted in the structure itself, just a pointer to the object in memory that will be dynamically allocated when the string is instantiated - but the characters are there correctly as demonstrated by the last 2 prints
You will note that the String characters are not counted in the structure itself, just a pointer to the object in memory that will be dynamically allocated when the string is instantiated
. . . plus the String length and the String capacity, making even an empty String consume six bytes of RAM.
AWOL:
. . . plus the String length and the String capacity, making even an empty String consume six bytes of RAM.
I don't know if I've ever used the String class, so I did not know this...thanks! Does this mean that each element in a String array has something like a descriptor block associated with it?
econjack:
I don't know if I've ever used the String class, so I did not know this...thanks! Does this mean that each element in a String array has something like a descriptor block associated with it?
protected:
char *buffer; // the actual char array
unsigned int capacity; // the array length minus one (for the '\0')
unsigned int len; // the String length (not counting the '\0')