How to store a string as an array


I was wondering if there was a way to store a string as an array? Not toCharArray(), but something like

exampleString[1] = “stuff”
exampleString[2] = “things”


Nevermind, found an entire article finally devoted to it. Sorry.

A string is an array"

const char *sarray = "Hello";

Serial.print( sarray[4] );  // prints 'o'


const char *sarray = "Hello";

If the sarray pointer is ever changed, the string literal will be “stranded” in memory. Either of these two definitions is safer:

const char * const sarray = "Hello";
const char sarray[] = "Hello";