title: Implement delete repeat function with pointer
body: <p>I confuse how to implement shift left function to replace the repeating element.
  I try to comment the best I can on my code.
  Please point out my mistake, so i can fix it myself.</p>
  <pre><code>template &lt;typename T&gt;
  void shift_left(T *a, int &amp;a_size)
  {
      T*b ;  // walker to check if the same element
      b=a;    //point b to a address
      b++;    //move b to the next element
      int *endptr;    //declare end pointer
      endptr += a_size;   // end pointer to the end
      int *c;     // c pointer to shift element back
      int i =0, j;    
      while (i &lt; a_size &amp;&amp; b != endptr)   //true when counter smaller than 
                                  //arr size and b point not at the end
      {
          if (*a != *b)           
          {
              b++;        //increment b if a !=b
          }
          else if (*a == *b) // a ==b 
          {
              *b = *b++;  // replace next element with b element
              a_size--;   //reduct arr size
          }
      }
      for (j = 0; j &lt; a_size; j++) // print out array loop
      {
          cout&lt;&lt; *a &lt;&lt; &quot;\t&quot;;
          a++;
      }
  }
  </code></pre>