//WAP to initialize elements of an array of size 2x2. Then display that.
#include <stdio.h>
#include<conio.h>
void main()
{
int a[2][2]={1,2,3,4};
int i,j;
for(i=0;i<=1;i++)
{
for(j=0;j<=1;j++)
{
printf("%d",a[i][j]);
}
printf("\n");
}
getch();
}
#include <stdio.h>
#include<conio.h>
void main()
{
int a[2][2]={1,2,3,4};
int i,j;
for(i=0;i<=1;i++)
{
for(j=0;j<=1;j++)
{
printf("%d",a[i][j]);
}
printf("\n");
}
getch();
}
-----------------------------------------------------------------------------------
or
----------------------------------------------------------------------------------------------------------
#include <stdio.h>
#include<conio.h>
void main()
{
int a[2][2]={{1,2},{3,4}};
int i,j;
for(i=0;i<=1;i++)
{
for(j=0;j<=1;j++)
{
printf("%d",a[i][j]);
}
printf("\n");
}
getch();
}