EmbLogic's Blog

2 Dimensional Array

CODE :

#include<stdio.h>
int main()
{
int **a,**b;
int i,j;
a=(int **)malloc(sizeof(int)*10);
b=(int **)malloc(sizeof(int)*10);
for(i=0;i<10;i++)
{
*(a+i)=(int *)malloc(sizeof(int)*10);
*(b+i)=(int *)malloc(sizeof(int)*10);
}
printf(“Enter Elements of Array is:\n”);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
scanf(“%d”,(*(a+i)+j));
}
}
printf(“Elements are:\n”);
for(i=0;i<3;i++)
{
for(j=0;j<3;j++)
{
printf(“%d\t”,*(*(a+i)+j));
}
printf(“\n”);
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>