Memory reallocation in c++

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sreenadh494
    New Member
    • Aug 2007
    • 13

    Memory reallocation in c++

    how we are reallocation memory in c++, is there any functions or automatically reallocated
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    Well obviously if you used malloc you can use realloc.

    If you didn't use malloc but chose an OO approach then you probably wont need to realloc any memory. If you need to reallocate that suggests you are using an array. Arrays are not the thing to use in C++ you should be using one of the STL container classes which handle the allocating and reallocating of data for you.

    Comment

    Working...