The variables arr1 and arr2 have been declared as pointers to integers. An array of 10 elements has been allocated, its pointer assigned to arr1, and the elements initialized to some values. Allocate an array of 20 elements, assign its pointer to arr2, copy the 10 elements from arr1 to the first 10 elements of arr2, and initialize the remander of the elements of arr2 to 0.

Can someone help me get started on this program. This is a question from myprogramminglab..

1 answer

Don't know you still use pointers in C++, but that's OK.

To declare pointer arr1 to an integer, you would do
int *arr1;

Assuming you have assigned an array called iarray:
int iarray[20];

Assigning the pointer to the beginning of the array is
arr1=iarray; // or
arr1=iarray[0];
Hope that gets you started.