View Single Post
  #4 (permalink)  
Old 09-14-2008, 12:52 PM
Aereshaa's Avatar   
Aereshaa Aereshaa is offline
Guru
 
Join Date: Apr 2008
Posts: 585
Last Blog:
I don't like the word ...
Credits: 0
Rep Power: 9
Aereshaa is just really niceAereshaa is just really niceAereshaa is just really niceAereshaa is just really nice
Default Re: Reallocate Memory

No. The new operator may allocate memory a different way, so even if it works on your system, it might not work on other peoples'. Better to allocate using the function malloc() and deallocate using free():
Code:
int * array = malloc(10 * sizeof(int));
array = realloc(array, 15 * sizeof(int));
free(array);
Reply With Quote