#include #include using namespace std; int *twiceAsManyValues(int a[], int size) { int *x = new int[size*2]; int i; for (i = 0; i < size;i++) { x[i*2] = a[i]; x[i*2+1] = a[i]; } return x; // a = new int[10]; // does not work } int main() { int a[5] = {1,2,3,4,5}; int *b; int i; b = twiceAsManyValues(a,5); for (i=0;i<10;i++) cout << b[i] << " "; cout << endl; delete b; return 0; }