// John Bent's CS 110 Hand-out 17 // Addresses v. contents // // This program prints out the addresses and values of both a // standard integer variable and an integer array. #include int main() { int x = 5; int y[50]; for (int i = 0; i < 50; i++) { y[i] = 50 - i; } cout << "\nDeclare and initialize two variables. Int x and int array y.\n"; cout << "Here is the value of x: " << x; cout << endl; cout << "Here is the address of x: "<< &x; cout << endl; cout << endl; cout << "Here is the value of y[0]: " << y[0]; cout << endl; cout << "Here is the array name y outputted: " << y; cout << endl; cout << "Here is the address of the array name outputted: " << &y; cout << endl; cout << endl; for (int j = 0; j < 5; j++) { cout << "Here is the address of y[" << j << "]: " << &y[j]; cout << endl; } return 0; }