title: How to extract specific column from 2D array
body: <p>I have an array and i want to extract specific column from it, let's say the 3rd column only.</p>
  
  <p><strong>Example:</strong></p>
  
  <blockquote>
    <p>1  2  3  4<br>
    1  2  3  4<br>
    1  2  3  4<br>
    1  2  3  4 </p>
  </blockquote>
  
  <p>What is want is to extract 3rd column and display only:</p>
  
  <blockquote>
    <p>3<br>
    3<br>
    3<br>
    3</p>
  </blockquote>
  
  <p>This is my code where i am able to create a dynamic array specified by the user:</p>
  
  <pre><code>int r;
  int c;
  Console.Write("Enter number of rows: ");
  r = (int)Convert.ToInt32(Console.ReadLine());
  Console.Write("Enter number of columns: ");
  c = (int)Convert.ToInt32(Console.ReadLine());
  int[,] matrix = new int[r, c];
  
  /*Insert Values into Main Matrix
   --------------------------------------------------------------------------------*/
  for (int row = 0; row &lt; r; row++)
  {
      for (int col = 0; col &lt; c; col++)
      {
          Console.Write("Enter value for matrix[{0},{1}] = ",row, col);
          matrix[row, col] = (int)Convert.ToInt32(Console.ReadLine());
      }
  }
  
  
  /*Print and show initial Matrix
   --------------------------------------------------------------------------------*/
  Console.WriteLine("Your matrix is,");
  for (int row = 0; row &lt; r; row++)
  {
      for (int col = 0; col &lt; c; col++)
      {
          Console.Write(matrix[row, col] + " ");
      }
      Console.WriteLine();
  }
  
  
  /*Fixing first 2 columns
   --------------------------------------------------------------------------------*/
  int startingMatrixCols = 2;
  Console.WriteLine("Fixed first 2 columns:");
  for (int row = 0; row &lt; r; row++)
  {
      for (int col = 0; col &lt; startingMatrixCols; col++)
      {
          Console.Write(matrix[row, col] + " ");
      }
      Console.WriteLine();
  }
  </code></pre>