-->
Showing posts with label WAP to initialize elements of an array of size 2x2. Then display that.. Show all posts
Showing posts with label WAP to initialize elements of an array of size 2x2. Then display that.. Show all posts

WAP to initialize elements of an array of size 2x2. Then display that.

//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();
}


-----------------------------------------------------------------------------------
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();
}