P171. WAP to print elements of integer 2d array using pointer to an array.
#include<stdio.h>
int
a[3][5]={{1,2,3,4,5},{6,7,8,9,10},{11,12,13,14,15}};
void
main()
{
int (*p)[5],j,i;
p=&a;
for(i=0;i<3;i++)
{
for(j=0;j<5;j++)
printf("%d
",p[i][j]);
printf("\n");
}
}
Comments
Post a Comment