title: warning C4172: returning address of local variable or temporary
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4570366/pointer-to-local-variable">Pointer to local variable</a>  </p>
  </blockquote>
  
  
  
  <p>I've read a lot of other topics on this site about the same problem knowing it would be common. But I guess I'm dumb and can't figure out the proper way to do it. So, I apologize for yet another one of these questions and I'm hoping someone can give me a simple solution and/or explanation.</p>
  
  <p>Here's the entire code:</p>
  
  <p><strong>Main.c</strong></p>
  
  <pre><code>#define WIN32_LEAN_AND_MEAN
  
  #include &lt;Windows.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;tchar.h&gt;
  
  
  LPTSTR GetApplicationPath ( HINSTANCE Instance );
  
  
  int APIENTRY _tWinMain ( HINSTANCE Instance, HINSTANCE PreviousInstance, LPTSTR CommandLine, int Show )
  {
      LPTSTR sMessage = GetApplicationPath ( Instance );
  
      MessageBox (
          NULL,
          sMessage,
          _T ( "Caption!" ),
          MB_OK
      );
  
      return 0;
  }
  
  
  LPTSTR GetApplicationPath ( HINSTANCE Instance )
  {
      _TCHAR sReturn[MAX_PATH];
  
      GetModuleFileName ( (HMODULE) Instance, sReturn, MAX_PATH );
  
      return sReturn;
  }
  </code></pre>