title: How to break scanf %d loop with \n
body: <p>I am entering integers separated by spaces into a 2d array as follows (assume always more than 1 and less than 10 values are entered by the user):</p>
  
  <pre><code>for (i = 0; i &lt; rows; ++i)
      {
          while (scanf("%d", &amp;arr[i][j++]) == 1)
              ++j;
      }
  </code></pre>
  
  <p>I want to stop the entering of values into [i][j] when I start a new line and begin assigning values to [i+1][j] etc. So if I input something like:</p>
  
  <pre><code>12 54 2 4
  1 2
  </code></pre>
  
  <p>I would have the values contained like this:</p>
  
  <pre><code>row 1 = {12, 54, 2, 4}
  row 2 = {1, 2}
  </code></pre>
  
  <p>etc.</p>