title: C - Access a certain row or column in a matrix
body: <p>I want to know how I can print a certain row, certain column and the anti diagonal in an NxN matrix. So far I know how to print the matrix itself and the main diagonal. As you can see in the code I'm printing the main diagonal.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int main() {
      int r1, c1;
      printf("\n Enter number of rows for M1");
      scanf("%d", &amp;r1);
      printf("\n Enter number of columns for M1");
      scanf("%d", &amp;c1);
      int m1[r1][c1];
      // int m2[][];
      int i, j;
      printf("\n Enter first Matrix: \n");
      for(i = 0; i &lt; r1; i++){
          for(j = 0; j &lt; c1; j++){
              scanf("%d", &amp;m1[i][j]);
          }
      }
  
      for(i = 0; i &lt; r1; i++){
          for(j = 0; j &lt; c1; j++){
              if(i == j){
                  printf("%d", m1[i][j]);
              }
          }
          printf("\n");
      }
      return 0;
  }
  </code></pre>