Lifetime of pointers value

tuxduino:
You mean the entire string is copied on the stack ? Interesting...

What would come out of the compiler if local_string[] was declared const ?

Going to check out...

This is what happens:

void loop() {
  const char local_string[] = "Will this string survive until second call to print_buffer()?"; 
  print_buffer();
  buffer[1] = local_string;    // <-------------- error here
}

Gives:

sketch_sep20a.cpp: In function 'void loop()':
sketch_sep20a:14: error: invalid conversion from 'const char*' to 'char*'

Which makes sense. You have a pointer to the local string. You save the pointer. How does the compiler know what you will do with it later? You can't have a pointer to const become a pointer to non-const.