Lifetime of pointers value

tuxduino:
If the variable was declared as const, i.e. "read-only", the compiler could figure a copy of the string was unnecessary, since the code would not change the string content in any way. What I'm curious about is how the output asm changes.

What happens depends on the compiler implementation. There is no "language level" guarantee that just because you use the const keyword that the compiler wont trash the string memory once the variable goes out of scope. It just means that the compiler can treat the string as constant while it is still in scope (i.e., you aren't going to do something like local_string[4] = 'a'), and the compiler can arrange things as it sees fit using that assumption.

The static keyword is stronger in that sense. It says to the compiler "you must preserve this in case I ever call this function again".