To manipulate text in Arduino, I can use the C language style of string which is an array of characters. Another way is to use the C++ way which is to use the String object.
What is the difference between the 2 approaches? What are the pros and cons of using String object versus an array of char?
For me, it seems like a no-brainer to use String object because the code becomes more readable. Are there situations when using an array of char would be better?
lightaiyee:
For me, it seems like a no-brainer to use String object because the code becomes more readable. Are there situations when using an array of char would be better?
The situation when using an array of char and nullterminated strings would be better: if you are programming for a microcontroller which has very limited amounts of RAM available (i.e. 2KB instead of 2MB or 2GB) with no extra "virtual RAM" available in a "swap file".