title: What if the function would return a pointer to a char array and I would not use it
body: <p>So, for example i have this function:</p>
  <pre><code>char* retCharPtr(void) {
      char data[15] {&quot;Data is here&quot;};
      return data; }
  </code></pre>
  <p>And</p>
  <pre><code>char* retCharPtr1(void) {
      char *data = new char[15];
      strcat(data, &quot;Data is here&quot;);
      return data; }
  </code></pre>
  <p>Please explain where the data array will be placed if <code>std::cout &lt;&lt; retCharPtr1();</code>,
  and what if <code>std::cout &lt;&lt; retCharPtr();</code>?</p>
  <p>And in general, where do the values ​​of variables go when functions return their status (<code>int</code>) and it is not stored anywhere. Are these 4 bytes occupied during the full execution of the program?</p>
  <p>I need the function to return an array for <code>cout</code>, without the next call <code>delete</code>, and leaks in memory.</p>