int arr[10] = {23, 122, 41, 67};
cout << " address of first memory block is " << arr << endl; // 0x61fefc (sample address for arr)
cout << arr[0] << endl; // 23
cout << " address of first memory block is " << &arr[0] << endl; // 0x61fefc (same as arr)
cout << "4th " << *arr << endl; // 23
cout << "5th " << *arr + 1 << endl; // 24
cout << "6th " << *(arr + 1) << endl; // 122
cout << "7th " << *(arr) + 1 << endl; // 24
cout << "8th " << arr[2] << endl; // 41
cout << "9th " << *(arr + 2) << endl; // 41
cout << i[arr] << endl; // 67 (i[arr] == *(i + arr) == arr[3])
cout << sizeof(temp) << endl; // 40 (10 * 4 bytes)
cout << " 1st " << sizeof(*temp) << endl; // 4 (int)
cout << " 2nd " << sizeof(&temp) << endl; // 8 (pointer to int[10])
cout << sizeof(ptr) << endl ; // 8 (pointer size)
cout << sizeof(*ptr) << endl ; // 4 (int)
cout << sizeof(&ptr) << endl ; // 8 (pointer to pointer)
cout << " ->" << &a[0] << endl; // 0x61fecc (sample address)
cout << &a << endl; // 0x61fecc (same as &a[0]; types differ but address same)
cout << a << endl; // 0x61fecc (same as above)
cout << p << endl; // 0x61fecc (points to first element)
cout << *p << endl; // 1 (a[0])
cout << "-> " << &p << endl; // 0x61feb0 (address of pointer variable p)
arr = arr + 1; // Error: cannot assign to array variable (arrays are not pointers)
cout << ptr << endl; // 0x61feac (sample address)
cout << ptr << endl; // 0x61feb0 (next int position, +4 bytes)