Change Array size C++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Change Array size C++

Is there any way to change the size of an array in C++?

8th Jan 2017, 2:36 PM
Konstantinos Psaroulakis
Konstantinos Psaroulakis - avatar
1 Answer
+ 4
Arrays are static in C++, not dynamic... to change the size of an array, you need to allocate memory for a new one, with the new size, and copy elements... On the other hands, C++ provides a certain number of listes-like-structures and others keys-values-lists which are usefull for dynamics data structures control ;)
8th Jan 2017, 2:42 PM
visph
visph - avatar