[2D] ARRAY
____________
2D ARRAY
____________
why 2D array
.To store data in group
EX = if you want to store marks of two classes students
then you store 1st class data in first dimension and 2nd class data in 2nd dimension.
$$$$$$$
SYNTAX
$$$$$$$
datatype name of array [number of variable][no. of variable] ;
EX = int a[3][3];
^^^^^^^^^^^^^^^^^^^^
Memory structure
RUN SCREEN
$$$$$$$$$$$$
SOURCE CODE
$$$$$$$$$$$$
#include<stdio.h>
#include<conio.h>
// CODE BY [UB] //
main()
{
int a[3][3],b[3][3],c[3][3],i,j;
printf("enter first 9 number matrix= ");
for(i=0; i<=2; i++)
for(j=0; j<=2; j++)
scanf("%d",&a[i][j]);
printf("enter next 9 number matrix= ");
for(i=0; i<=2; i++)
for(j=0; j<=2; j++)
scanf("%d",&b[i][j]);
printf("########");
for(i=0; i<=2; i++)
{
for(j=0; j<=2; j++)
{
c[i][j]=a[i][j]+b[i][j];
printf("\n");
printf("%d ",c[i][j]);
}
printf("\n");
}
printf("########");
getch();
}
#########################
ALL RIGHTS GOES TO [UB CODES]
##########################
\---------------------------------------------------------/