944,038 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 3889
  • C++ RSS
Feb 28th, 2006
0

Creating dynamic arrays

Expand Post »
I'm coding in VC++.net (managed C++). Is there a way to create dynamic arrays and preserving the data when the dimensions are changed? I know that Visual Basic can do this.

In VB:
ReDim Preserve mLn(UBound(mLn) + 1)
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
DotNetUser is offline Offline
69 posts
since Jun 2005
Feb 28th, 2006
0

Re: Creating dynamic arrays

In C you would use realloc(). In C++ you have to emulate it. Allocate the new area, copy the old stuff to the new area, and free the old area.
Reputation Points: 185
Solved Threads: 28
Posting Whiz in Training
dwks is offline Offline
269 posts
since Nov 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Address book problems....Any advice???
Next Thread in C++ Forum Timeline: check for errors in my code





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC