12345678
void copy(int a[], int n, int copied[]) //n is the number of elements { int i; for(i=0 ;i<n;++i) { copied[i]=a[i]; } }
int*
void copy(int* a[], int n, int* copied[])
12345678910111213141516171819
#include <iostream> void copy(int a[], int n, int copied[]) { int i; for(i=0 ;i<n;++i) { copied[i]=a[i]; } } int main() { int arr1[3] = {2, 8, 1}; int arr2[3]; copy(arr1, 3, arr2); std::cout << arr2[0] << ' ' << arr2[1] << ' ' << arr2[2] << std::endl; }