title: Where is return value from function stored
body: <p>I've read few articles about stack, heap and how they are used in program execution. <a href="http://www.c-sharpcorner.com/UploadFile/rmcochran/csharp_memory01122006130034PM/csharp_memory.aspx" rel="nofollow">Here</a> is one of them.
  It is always said that when calling a function, it's parameters are placed to stack, as well as local variables (strictly saying that's not correct, as Eric Lippert described in <a href="http://blogs.msdn.com/b/ericlippert/archive/2010/09/30/the-truth-about-value-types.aspx" rel="nofollow">his post</a>, but that's not my question now).</p>
  
  <p>My question is <strong>where the return value from function is stored and how is it passed to the caller?</strong> Nobody says it's placed on stack, but still nobody says it's not. Can anybody clarify that?</p>
  
  <p>For example, consider the following function:</p>
  
  <pre><code>public DateTime GetTomorrowDate()
  {
      return DateTime.Now.AddDays(1).Date;
  }
  </code></pre>
  
  <p>Is my understanding that it will declare a local variable for return value correct? If so, why it isn't destroyed when function returns and it's stack frame destroyed? Is it declared in the caller's stack frame (even if it is not used by a caller)? Or maybe it is stored somewhere in a register (I don't believe that, because there may be not suitable-size register for some custom structure).</p>