2d array in c language
2D array in C# language
The array which is used to represent and store data in a tabular form is called as 'two dimensional array.' Such type of array specially used to represent data in a matrix form.
Column
Rows
The array which is used to represent and store data in a tabular form is called as 'two dimensional array.' Such type of array specially used to represent data in a matrix form.
Syntax:-
<data type><array name>[No of rows][No of columns] int a[3][3];
Initialization of 2D Array:-
<data type><array name>[No of rows][No of columns]
int list[3][5]={{1,2,3,4,5}{6,7,8,9,10}{11,12,13,14,15}};
Memory Allocation : Column
Rows
Example:- C# program which takes values for 2D-Array and print all in matrix form.
#include<stdio.h>
void main(){
int list[3][5],i,j;
printf("Enter value in 2D - array:\n");
for(i=0;i<3;i++)
{
for(j=0;j<5;i++)
{
printf("value of list[%d][%d]=",i,j);
scanf("%d",&list[i][j]);
}
}
printf("\n*******=value of array=********\n");
for(i=0;i<3;i++)
{
for(i=0;i<5;i++)
{
printf("%d\t",list[i][j]);
}
printf("\n\n");
}
getch();
}
Comments
Post a Comment