Two Dimensional Array in C

Two dimensional array are those type of array which has finite number of row and finite number columns.the declaration of two dimensional array is.

Declaration


datatype array_name[row_size][column_size];							
							

Example


#include<stdio.h>
#include<conio.h>

void main()
{
  int a[2][2],i,j;
   
  printf("Enter the 4 elements of matrix: ");
  for(i=0;i<2;i++)
  {
      for(j=0;j<2;j++)
	  {
           scanf("%d",&a[i][j]);
	  }
  }

  printf("\nThe matrix is\n");
  for(i=0;i<2;i++)
  {
      printf("\n");
      for(j=0;j<2;j++)
	  {
           printf("%d\t",a[i][j]);
	  }
  }
 
  getch();
}							
							
Share Share on Facebook Share on Twitter Share on Google+ Share on LinkedIn Pin on Pinterest Share on Stumbleupon Share on Tumblr Share on Reddit Share on Diggit