#include using namespace std; int main() { int i = 10; int j = 20; int k = 30; int l = 40; int m = 50; int *ptr1 = &i; int *ptr2 = &m; cout << "The address of the variable i is " << ptr1 << " containing the value " << *ptr1 << endl; ++ptr1; cout << "The next addressable address is " << ptr1 << " containing the value " << *ptr1 << endl; ptr1 -= 2; cout << "The previous addressable address is " << ptr1 << " containing the value " << *ptr1 << endl << endl; ptr1 = ptr2; cout << "The address of the variable m is " << ptr1 << " containing the value " << *ptr1 << endl; ++ptr1; cout << "The next addressable address is " << ptr1 << " containing the value " << *ptr1 << endl; ptr1 -= 2; cout << "The previous addressable address is " << ptr1 << " containing the value " << *ptr1 << endl << endl; if (&i <= &m) { for (int *a = &i; a <= &m; a++) { cout << "Address " << a << " contains the value " << *a << endl; } } else { for (int *a = &m; a <= &i; a++) { cout << "Address " << a << " contains the value " << *a << endl; } } int *a; int num; cout << endl; if (&i <= &m) { a = &i; num = (&m - &i); } else { a = &m; num = (&i - &m); } for (int c = num; c >= 0; c--) { cout << "Address " << a+c << " contains the value " << a[c] << endl; } return 0; }