#include <iostream.h>


int main(int argc, char *argv[])
{
   int i, N;
   int *p, *q;

   N = 10;
   p = new int[N];

   p[0] = 12; p[1] = 23; p[2] = 34; p[3] = 45; p[4] = 56;
   p[5] = 67; p[6] = 78; p[7] = 89; p[8] = 90; p[9] = 111;

   for ( i = 0; i < N; i++ )
   {
      cout << p[i] << " ";
   }
   cout << endl << endl;    

   /* ------------------------------------
      Double the side of the array
      ------------------------------------ */
   q = new int[2*N];      // array of 20 elements      

   for ( i = 0; i < N; i++ )
      q[i] = p[i];       // Copy old array to new array    


   delete(p);             // Free unused space !!!

   p = q;                 // Switch p over to the new array
   N = 2*N;               // Remember new array size 


   p[10] = 112; p[11] = 123; p[12] = 134; p[13] = 145; p[14] = 156;
   p[15] = 167; p[16] = 178; p[17] = 189; p[18] = 190; p[19] = 1111;

   for ( i = 0; i < N; i++ )
   {
      cout << p[i] << " ";
   }
   cout << endl << endl;    

}