title: Reading individual digits of an integer
body: <p>I have an unsigned int, say 12345 for example.  I want to iterate through each one of the digits of this integer and put them into an array, like so:
      array[1, 2, 3, 4, 5]
  The number of digits in the integer is already known and stored in another variable, size.</p>
  
  <p>Can someone propose a simple algorithm that would iterate over the digits in the integer and extract them individually?</p>
  
  <p>update
  Here's what I'm thinking:</p>
  
  <pre><code>    function  (const unsigned int value){
          //find length of unsigned int 'value'
          unsigned int i = value;
          unsigned int x = value;
          int j = 0;  //counter
          for(int j = 0; i &gt; 0; j++){
              i = i/10;
          }//end for
          size = j;
          array = new int[size];
          //read in digits of 'value' into array
          for(int i = size-1; i &gt;= 0; i--){   
              array[i] = x % 10;
              x = x / 10;
          }//end for
      }
  </code></pre>