Good job nick, the pointer works out for a nice solution. This worked out equivalent, but without warnings.
void loop() {
const char * const &local_string = "Will this string survive until second call to print_buffer()?";
print_buffer();
buffer[1] = (char*)local_string;
}
I'm not sure how safe it is though, it expects buffer[1][?] to never be written, which can now be done if not careful.
void print_buffer() {
static byte i =0;
buffer[1][ random(0,30) ] = 'z';
Serial.println(buffer[i]);
i = (i==0) ? 1 : 0;
}
This will inject 'z' into the constant string.
EDIT: declaring buffer as 'char const * buffer[2];' fixes it and doesn't need the char* cast in loop.