title: In C - How would I use scanf to store a random amount of ints to a 2d array
body: <p>I was wondering how you would do the following:</p>
  
  <p>I provide the width and height of a grid as command line arguments, and I now need to read the grid from standard input and store it into a 2d array. if the command line arguments are just standard integers and the grid is in the following format:</p>
  
  <pre><code>1 2 3 4 5 6 ... x
  1 2 3 4 5 6 ... x
  1 2 3 4 5 6 ... x
  . . . . . . ... x
  y y y y y y  y  y
  </code></pre>
  
  <p>how would I read this? I'm getting really confused because I don't have a static number of rows and columns since the values of each can change based off user input.</p>