Skip to main content
fixed the links
Source Link
DarkWanderer
  • 8.9k
  • 1
  • 30
  • 57

No, you can't... [realloc()][1]realloc() can only be used with malloc()/free()

Best call for a new[] allocated array is to create a new one and then memcpy() the data from one to another.

Better way - use an [std::vector][2]std::vector or [std::string][3]std::string instead of array if you know you'll need resizing. Internally they're pretty much the same array.

No, you can't... [realloc()][1] can only be used with malloc()/free()

Best call for a new[] allocated array is to create a new one and then memcpy() the data from one to another.

Better way - use an [std::vector][2] or [std::string][3] instead of array if you know you'll need resizing. Internally they're pretty much the same array.

No, you can't... realloc() can only be used with malloc()/free()

Best call for a new[] allocated array is to create a new one and then memcpy() the data from one to another.

Better way - use an std::vector or std::string instead of array if you know you'll need resizing. Internally they're pretty much the same array.

added links
Source Link
DarkWanderer
  • 8.9k
  • 1
  • 30
  • 57

No, you can't... realloc[realloc()][1] can only be used with malloc()/free()

Best call for a new[] allocated array is to create a new one and then memcpy() the data from one to another.

Better way - use an std[std::vectorvector][2] or std[std::stringstring][3] instead of array if you know you'll need resizing. Internally they're pretty much the same array.

No, you can't... realloc() can only be used with malloc()/free()

Best call for a new[] allocated array is to create a new one and then memcpy() the data from one to another.

Better way - use an std::vector or std::string instead of array if you know you'll need resizing. Internally they're pretty much the same array.

No, you can't... [realloc()][1] can only be used with malloc()/free()

Best call for a new[] allocated array is to create a new one and then memcpy() the data from one to another.

Better way - use an [std::vector][2] or [std::string][3] instead of array if you know you'll need resizing. Internally they're pretty much the same array.

added 20 characters in body
Source Link
DarkWanderer
  • 8.9k
  • 1
  • 30
  • 57

No, you can't... realloc() can only be used with malloc()/free()

Best call for a new[] allocated array is to create a new one and then memcpy() the data from one to another.

Better way - use an std::vector or std::string instead of array if you know you'll need resizing. Internally it'sthey're pretty much the same array.

No, you can't... realloc() can only be used with malloc()/free()

Best call for a new[] allocated array is to create a new one and then memcpy() the data from one to another.

Better way - use an std::vector instead of array if you know you'll need resizing. Internally it's pretty much the same array.

No, you can't... realloc() can only be used with malloc()/free()

Best call for a new[] allocated array is to create a new one and then memcpy() the data from one to another.

Better way - use an std::vector or std::string instead of array if you know you'll need resizing. Internally they're pretty much the same array.

Source Link
DarkWanderer
  • 8.9k
  • 1
  • 30
  • 57
Loading