// uses a pointer to access array elements

#include <iostream>
using namespace std;

int main()
{

  int arr[10] = {99, 35, 87, 100};
  int *iptr;

  iptr=arr;  // iptr points to beg of arr  

  cout << "size of the array arr is: " << sizeof(arr) << endl;
  cout << "address of array arr is: " << arr << endl;
 
  cout << "address of array arr is (displaying iptr): " << iptr << endl;
  cout << "size of iptr: " << sizeof(iptr) << endl;
  
  cout << "0th value in arr: " << *arr << endl; // same as arr[0] 
  cout << "3rd value in arr: " << *(iptr+3) << endl; // same as arr[3] 

  cout <<  "address of arr[3] " <<  &arr[3] << " same as iptr+3: " << iptr+3 << endl;


 // left out () in the following stmt
  cout << "arr[0]+3 is: " << *iptr+3 << endl; // same as arr[0] 

  return 0;
}





