title: Converting integer to array
body: <p>So far I have written a few lines to convert an integer to an array.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int main(int argc, char *argv[]){
      int num = 9214;
      int count = 3;
      char numarray[3];
      int temp;
  
      while(num &gt; 0){
          temp = num % 10;
          numarray[count] = temp;
          num /= 10;
          count--;
      }
  
      printf("Array: ");
      for(count = 0; count &lt;= 3; count++)
      printf("%d", numarray[count]);
      printf("\n\n");
  }
  </code></pre>
  
  <p>The output <em>should</em> be 9214. However, it returns as 9219.
  If I change the variable <em>num</em> 5183, it would return as 5185.
  It changes the last number of the array to the first number of the <em>num</em> variable. </p>
  
  <p>Does anyone have any idea where I've messed up?</p>