title: passing new object to function c++
body: <p>I just want to know if this is a bad practice to do.</p>
  
  <pre><code>for(int i=0;i&lt;1000;i++)
      happyFunction(new Car());
  </code></pre>
  
  <p>The new <code>car()</code> object should live after calling it from <code>happyFunction</code> and later it should be destroyed .
  Now is that ok to do. I mean shouldn't I delete the memory allocated for that instance?</p>
  
  <p>Example to make it more clear.</p>
  
  <pre><code>int i = 0;
  for (i=0;i&lt;1000;i++){
      new car();
  }
  </code></pre>
  
  <p>Is this a good practice to do? Should I delete the memory allocation?
  I hope my question is clear.
  thank you.</p>