Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

In all of the cases the malloc and free takes slightly (although very slightly) longer than new - except the first one, but in all of the other test that I did, the first always takes significantly longer than the rest.  I tried to fix this problem by mallocing and freeing one first, but it did not work.  So, it is hard to tell if this difference is due to the malloc and free operations or from the fact that that was the first allocating.  

3) I made a haiku to show the new way to allocate and deallocate memory in C.

Image Added

This shows how int arrays can be allocated using new and then deallocated using delete.