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
|
#include <iostream>
using namespace std;
void zero_out_array(int *arr, int n);
void copy_array(int *p1, int *p2);
int a[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int b[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int main() {
cout << "Array one is: ";
for(int i=0;i<10;i++){
cout << a[i] << " ";
}
cout << endl;
cout << "Array two is: ";
for(int x=0;x<10;x++){
copy_array(b,a);
cout << b[x] << " ";
}
system("PAUSE");
return 0;
}
void copy_array(int *p1, int *p2){
*p1++ = *p2++;
}
|