// Pointers and arrays
#include <iostream>
using namespace std;

int main(){
  float  a[5];
  float *p;

  p = a;       // p holds the adr. of the 1st element of a
 *p = 1.5;     // that means a[0] = 1.5;

  p = &a[1];   // now p holds the adr. of the 2nd element
 *p = 2.2;     // that means a[1] = 2.2;

  p = a + 2;   // now p holds the adr. of the 3rd element
 *p = 7.1;     // that means a[2] = 7.1;

  p = a;       // now p holds the adr. of the 1st element of a
 *(p+3) = 8.3; // that means a[3] = 8.3;
 *(p+4) = 9.9; // that means a[4] = 9.9;

  cout << "  a[i]: ";
  for (int i=0; i<5; i++) cout << a[i]   << "  ";
  cout << endl;
  cout << "*(p+i): ";
  for (int i=0; i<5; i++) cout << *(p+i) << "  ";
  cout << endl;

  return 0;
}
