title: How could I divide a number such as 123 into 1, 2, and 3 in C?
body: <p>I want to get the decimal digits separately when I get the number.
  For example, if I get 123 or 321, I want to sort the array or print the digits "1 2 3" or "3 2 1" in C. </p>
  
  <p>Would you please give me some any advice? Use C grammar? </p>
  
  <pre><code>int nums;
  scanf("%d", &amp;nums) // imagin this nums is 123
  
  // and how can I get the number 1,2,3? 
  </code></pre>
  
  <p>In the array. I will sort the number like</p>
  
  <pre><code>for(int i = 0; i&lt;3; i++)
   array[i] = nums;
  </code></pre>
  
  <p>and I expect in the array number is probably {1,2,3};</p>