title: memory questions, new and free etc. (C++)
body: <p>I have a few questions regarding memory handling in C++.</p>
  
  <ol>
  <li><p>What's the different with <code>Mystruct *s = new Mystruct</code> and <code>Mystruct s</code>? What happens in the memory?</p></li>
  <li><p>Looking at this code:</p>
  
  <pre><code>struct MyStruct{
      int i;
      float f;
  };
  
  MyStruct *create(){
      MyStruct tmp;
      tmp.i = 1337;
      tmp.j = .5f;
      return &amp;tmp;
  }
  
  int main(){
      MyStruct *s = create();
      cout &lt;&lt; s-&gt;i;
  
      return 0;
  }
  </code></pre></li>
  </ol>
  
  <p>When is <code>MyStruct tmp</code> free'd?
  Why doesn't <code>MyStruct tmp</code> get automatically free'd in the end of <code>create()</code>?</p>
  
  <p>Thank you!</p>