title: Input ints separated by whitespace and pass them to an int array
body: <p>I'm trying to write a program in C where the user inputs a defined number of ints (in this case 5 ints) separated by whitespaces. Then, the input is stored in an int array so, lastly, it can be stored in a char array.</p>
  
  <p>As an example of how the program is intended to work, when it asks for an input:</p>
  
  <pre><code>Input: 20 5 63 4 127
  </code></pre>
  
  <p>The output of the program should be:</p>
  
  <pre><code>Output: 20 5 63 4 127
  </code></pre>
  
  <p>This is what I've written so far, but I don't know how to get the input transformed into an int array. Note that I know the length of the input beforehand (in this case, as said above, 5 ints).</p>
  
  <pre><code>// Input: 20 5 63 4 127
  
  
  // Ask for user input.
  
  // Store the input in this int array.
  int input_int_array[5];
  
  unsigned char char_array[5];
  
  for(int i=0;i&lt;5;i++)
  {
      char_array[i]=input_int_array[i];
  
      printf("%d ", char_array[i]);
  }
  
  // Should print: 20 5 63 4 127
  </code></pre>