Oct 2, 2004 #1 nbgoku Programmer May 25, 2004 108 US if i set my array size to be [6], can i change it to [24] later on or is this not allowed with arrays?
if i set my array size to be [6], can i change it to [24] later on or is this not allowed with arrays?
Oct 2, 2004 #2 Salem Programmer Apr 29, 2003 2,455 GB It's not allowed with arrays, but you can do it using memory allocation. The initial array is created like this. Code: int *array; array = new int[6]; Throw away the old array of 6 elements and make it 24. Code: delete [] array; array = new int[24]; -- Upvote 0 Downvote
It's not allowed with arrays, but you can do it using memory allocation. The initial array is created like this. Code: int *array; array = new int[6]; Throw away the old array of 6 elements and make it 24. Code: delete [] array; array = new int[24]; --
Oct 3, 2004 #3 timmay3141 Programmer Dec 3, 2002 468 US I strongly recommend looking up the STL vector class instead of using dynamically allocated arrays directly. It will simplify things greatly. Upvote 0 Downvote
I strongly recommend looking up the STL vector class instead of using dynamically allocated arrays directly. It will simplify things greatly.