title: Using scanf to capture a string of integers into an array in C
body: <p>I am trying to use scanf to capture a string of numbers and convert it into a corresponding array. For example, a user would enter in 1234, then enter, and the following would be set:</p>
  
  <pre><code>array[0]=1
  array[1]=2
  array[2]=3
  array[3]=4
  </code></pre>
  
  <p>Here is my code so far:</p>
  
  <pre><code>    void user_input()
  {
    int cardarray[16];
    int i;
    char number;
    printf("Enter in the number:");
    for (i=0; i&lt;16; i++)
  {
    scanf("%c", &amp;number);
    number = cardarray[i] - '0';
      }
  
  
    printf("The number is %d\n", /*some value*/);
  }
  </code></pre>
  
  <p>I know you have to read characters and convert each into an integer digit, but I'm not exactly sure how.</p>