Skip to main content
gamedev.net
🔒 Locked

Realloc??

Started by reaptide 2 replies 550+ views
Original Post
reaptide
reaptide
Hey there everyone, I know that the realloc() function allows you to increase the size of a block of memory, but I was wondering if it conserves what is already stored in the memory before resizing it. I looked up the function on MSDN but it didn''t specify this. Is there a C++ equivalent for realloc(), similair to new()?
barazor
barazor
yes, realloc preserves what''s already in the array if you make it bigger

however, there''s no equivilant in C++, so you''d be better off using a std::vector if you go that route
reaptide
reaptide
Thanks a lot, I appriciate it.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.