title: What is a lifetime of a function return value?
body: <p>I read about the <code>return</code> values between function calls,<br>
   and experimented with the following code snippet :</p>
  
  <pre><code>/* file structaddr.c */
  #include &lt;stdio.h&gt;    
  #define MSIZE 10
  
  struct simple
  {   
      char c_str[MSIZE];
  };
  struct simple xprint(void)
  {
      struct simple ret = { "Morning !" };
      return ret;
  }
  int main(void)
  {   
      printf("Good %s\n", xprint().c_str);    
      return 0;
  }
  </code></pre>
  
  <p>The code is compiled without errors and warnings .<br>
  Tested with <em>GCC 4.4.3 (Ubuntu 4.4.3-4ubuntu5.1)</em> and <em>Visual C++</em> compilers .  </p>
  
  <pre><code> gcc -m32 -std=c99 -Wall -o test  structaddr.c  
   cl -W3 -Zi -GS -TC -Fetest structaddr.c
  </code></pre>
  
  <p>Output :<br>
  <em>Good Morning !</em></p>
  
  <p>I'm a little confused by the result .<br>
  The code is written correctly ?</p>
  
  <p>My Question :  </p>
  
  <ul>
  <li><p>What is the visibility of the function <code>return</code> value( array from a
     <code>struct</code> in above example ), and how to properly access them ?</p></li>
  <li><p>Where ends lifetime of a <code>return</code> value ?</p></li>
  </ul>