1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
 
  | 
#include <iostream>
using namespace std;
int *expandArray(int[], int);
void showArray(int[], int);
int main()
{
	const int size = 10;
	int array[size] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
	int *expand;
	expand = expandArray(array, size);
	cout << "Below is the original array " << endl;
	showArray(array, size);
	cout << "Below is the expanded array " << endl;
	showArray(expand, size);
	system("pause");
	return 0;
}
int *expandArray(int arr[], int size)
{
	int *expand;
	expand = new int[size * 2];
	memcpy(expand, arr, size * sizeof(int));
	for (int i = size; i < size * 2; i++)
		expand[i];
	return expand;
}
void showArray(int arr[], int size)
{
	for (int i = 0; i < size; i++)
		cout << arr[i] << " " << endl;
}
  |  |