How to Resize an Array of Strings in C++? Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report In C++, the array of strings is useful for storing many strings in the same container. Sometimes, we need to change the size of this array. In this article, we will look at how to resize the array of strings in C++. Resize String Array in C++There is no way to directly resize the previously allocated memory. But we can create a new array, copy all the elements, and then delete the previous array using new and delete operators. C++ Programs to Resize an Array in Strings C++ // C++ Program to Resize and Copy Elements in Dynamic Array #include <iostream> using namespace std; int main() { // Create an array of strings string* oldArray = new string[5]{ "Apple", "Banana", "Cherry", "Date", "Fig" }; // Display the elements in the old array cout << "Old Array Elements:" << endl; for (int i = 0; i < 5; ++i) { cout << oldArray[i] << endl; } // Create a new array with a larger size (e.g., double // the size) int newSize = 7; string* newArray = new string[newSize]; // Copy elements from the old array to the new array for (int i = 0; i < 5; ++i) { newArray[i] = oldArray[i]; } newArray[5] = "kiwi"; newArray[6] = "dragonfruit"; // Delete the old array delete[] oldArray; // Display the elements in the new array cout << "New Array Elements:" << endl; for (int i = 0; i < newSize; ++i) { cout << newArray[i] << endl; } // Delete the new array delete[] newArray; return 0; } OutputOld Array Elements: Apple Banana Cherry Date Fig New Array Elements: Apple Banana Cherry Date Fig kiwi dragonfruit Instead of this type of array we can use dynamic std::vector of strings which by default enables dynamic resizing. Comment More info S sourabhcao9e0 Follow Improve Article Tags : C++ Programs C++ cpp-string cpp-array CPP Array and String CPP Examples +2 More Explore C++ BasicsIntroduction to C++3 min readData Types in C++7 min readVariables in C++4 min readOperators in C++9 min readBasic Input / Output in C++5 min readControl flow statements in Programming15+ min readLoops in C++7 min readFunctions in C++8 min readArrays in C++8 min readCore ConceptsPointers and References in C++5 min readnew and delete Operators in C++ For Dynamic Memory5 min readTemplates in C++8 min readStructures, Unions and Enumerations in C++3 min readException Handling in C++11 min readFile Handling through C++ Classes8 min readMultithreading in C++8 min readNamespace in C++5 min readOOP in C++Object Oriented Programming in C++8 min readInheritance in C++10 min readPolymorphism in C++5 min readEncapsulation in C++4 min readAbstraction in C++4 min readStandard Template Library(STL)Standard Template Library (STL) in C++3 min readContainers in C++ STL3 min readIterators in C++ STL10 min readC++ STL Algorithm Library2 min readPractice & ProblemsC++ Interview Questions and Answers1 min readC++ Programming Examples4 min read Like