This is the same question asked in C# but i need for C++
How can I copy a part of an array to another array?
Consider I\'m having
int[] a = {
There is the C memcpy command, which you can use like this:
memcpy(destinationArray, sourceArray, sizeof(*destinationArray) * elementsToCopy);
There is also std::copy, which is a more C++ way of doing it:
std::copy(source, source + elementsInSource, destination);
Note that neither of these functions check to make sure that enough memory has been allocated, so use at your own risk!