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
|
#include "../../std_lib_facilities.h"
int main ()
{
int p0[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int* p1[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int q0[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int* q1[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
for (int i = 0; i < 10; ++i) {
p0[i] = 2 * (i + 1);
p1[i] = &p0[i];
}
for (int i = 0; i < 10; ++i) {
cout <<"Array place " << i << " has value " << p0[i] << ".\n";
}
cout << " \n";
for (int i = 0; i < 10; ++i) {
cout <<"Array place " << i << " has value " << q0[i] << ".\n";
}
cout << " \n";
cout << " \n";
for (int i = 0; i < 10; ++i) {
q1[i] = p1[i];
q0[i] = *q1[i];
}
for (int i = 0; i < 10; ++i) {
cout <<"Array place " << i << " has value " << q0[i] << ".\n";
}
keep_window_open();
return 0;
}
|