user55041: Look at this code :
char * function1()
{
    return « hello »
}
Where is stored hello string ?
Is there a copy ?
What i want to avoid is to have a memory leak or accessing to another string instead of hello
Thanks

user55899: String literals in C and C++ are stored in static memory, which in case of Arduino platform is ordinary data memory. 
If we overlook the typos, your code is essentially equivalent to
char *function1()
{
  static char literal[6] = { 'h', 'e', 'l', 'l', 'o', '\0' };
  return literal;
}

with a remark that in C and C++ you are not allowed to modify string literals. (Some nuances also depend on the specific language - C vs. C++ - which you failed to specify). Regardless of the language, it is always a better idea to use const char * pointers (as opposed to char *) to point to string literals.
There's no dynamic memory allocation here, and therefore no memory leaks possible. What you mean by "accessing another string" is not clear.

55041: <p>Look at this code :</p>

<p>char * function1()
{
    return « hello »
}</p>

<p>Where is stored hello string ?
Is there a copy ?</p>

<p>What i want to avoid is to have a memory leak or accessing to another string instead of hello</p>

<p>Thanks</p>
 55899: <p>String literals in C and C++ are stored in static memory, which in case of Arduino platform is ordinary data memory. </p>

<p>If we overlook the typos, your code is essentially equivalent to</p>

<pre><code>char *function1()
{
  static char literal[6] = { 'h', 'e', 'l', 'l', 'o', '\0' };
  return literal;
}
</code></pre>

<p>with a remark that in C and C++ you are not allowed to modify string literals. (Some nuances also depend on the specific language - C vs. C++ - which you failed to specify). Regardless of the language, it is always a better idea to use <code>const char *</code> pointers (as opposed to <code>char *</code>) to point to string literals.</p>

<p>There's no dynamic memory allocation here, and therefore no memory leaks possible. What you mean by "accessing another string" is not clear.</p>
