title: A version of strcopy function that copies integer arrays
body: <p>I have tried to replicate aa strcopy() function that deals with integer arrays in ANSI-C as an exercise to get familiar with functions.
  Here is a code I wrote:  </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main()
  {
      int array[10] = {0,2,3,4,5,6,7,8,9,10};
      int * pointer1;
      int * pointer2 = malloc(10 * sizeof(int));
      int i;
  
      //assign first pointer
      pointer1 = array;
  
      //print pointer1
      printf("Pointer1's array : \n");
      for(i=0;i&lt;10;i++)
      {
          printf("%d ",*(pointer1+i));
      }   
      printf("\n");
  
      //copy pointer1 to pointer2
      intCopy(pointer1,pointer2);
  
      //print pointer2's array 
      printf("Pointer2's array: \n");
      for(i=0;i&lt;10;i++)
      {
          printf("%d ",*(pointer2+i));
      }
      printf("\n");
  
  
  
      free(pointer2);
      return 0;
  }
  //copy an integer array
  int intCopy(int  * input, int * output)
  {
  
      //copy input to ouput element by element
      while((*output++=*input++) != '\0')
      {
          //copy each element until null terminator is found;
          output++;
          input++;
      }   
      return 0;
  }
  </code></pre>
  
  <p>The code was suppose to make pointer2 behave like pointer1 but with a new copy of the array.<br>
  However, when I tried printing the integers which pointer2 should be able to point to I got this:-<br>
  Pointer2's array:<br>
  0 0 0 0 0 0 0 0 0 0 </p>
  
  <p>I copied the code for the strcopy straight from the textbook and have no idea how only the first<br>
  element is copied successfully. I appreciate the help.</p>
  
  <p>EDIT: I have removed the extra incrementation done in the intCopy() function and the output is still   the same.</p>