title: Create a basic matrix in C (input by user !)
body: <p>I'm trying to ask the user to enter the number of columns and rows they want in a matrix, and then enter the values in the matrix... I'm going to let them insert numbers one row at a time.</p>
  
  <p>How can I create such function ?</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  main(){
  
  int mat[10][10],i,j;
  
  for(i=0;i&lt;2;i++)
    for(j=0;j&lt;2;j++){
    scanf("%d",&amp;mat[i][j]);
    } 
  for(i=0;i&lt;2;i++)
    for(j=0;j&lt;2;j++)
    printf("%d",mat[i][j]);
  
  }
  </code></pre>
  
  <p>This works for entering the numbers, but it displays them all in one line... The issue here is that I don't know how many columns or rows the user wants, so I cant print out %d %d %d in a matrix form...</p>
  
  <p>Any thoughts?</p>
  
  <p>Thanks :)</p>