title: c: reading negative numbers with scanf()
body: <p>I'm trying to read a list of input integers with scanf() separated by spaces into an array, but it breaks every time there's a negative number passed. How do I get it to read negative numbers as well? </p>
  
  <pre><code>for (int i = 0; scanf("%u", &amp;val)==1; i++)
  </code></pre>
  
  <p>stdin: </p>
  
  <pre><code>1 2 -4 5
  </code></pre>
  
  <p>It will only put 1 and 2 into the array and then stop reading the rest of the numbers (I think because of the '-'?). How would I fix this? </p>