How to best handle global Strings / strings / text data?

Wow, thank you Gustavo, Rick-K! Tons of info and still digesting, I didn’t see your ‘best practices’ thread so thank you.

So far I gather,
char arr[] = "Global, mutable strings from now on
is preferred per PKinOttawa in that thread. And basically stored in RAM per Rick-K above.

But wondering if ‘Memory management when modifying strings is programmer’s responsibility’ since it’s a C-style string (and seems like C++ strings aren’t a practice here; either C-style or String class). And if so, no action ultimately needed as char arr[] can be reassigned but never really fragments or uses memory beyond the longest string assigned to it.

And then what to make of const char* as found in Particle OS docs, used for typecasting right? Besides making immutable strings (program crashes if you try to reassign?) as Rick-K also showed. In general hoping to avoid complexities of pointers.

1 Like