title: How to return local array in C++?
body: <pre><code>char *recvmsg(){
      char buffer[1024];
      return buffer;
  }
  
  int main(){
      char *reply = recvmsg();
      .....
  }
  </code></pre>
  
  <p>I get a warning:</p>
  
  <blockquote>
    <p>warning C4172: returning address of local variable or temporary</p>
  </blockquote>