Best Industrial Training in C,C++,PHP,Dot Net,Java in Jalandhar

Monday, 27 January 2014

Demostration of 2D Array using pointers in C

#include<stdio.h>
#include<conio.h>
void main()
{
int i,j;
int (*a)[4];
clrscr();
printf("ennter elements of array:");
for(i=0;i<3;i++)
{
 for(j=0;j<3;j++)
 {
   scanf("%d",(*(a+i)+j));
 }
}
printf("output is:\n");

for(i=0;i<3;i++)
{
 for(j=0;j<3;j++)
 {
   printf("%d\t",(*(*(a+i)+j)));
 }
 printf("\n");
}
getch();
}

No comments:

Post a Comment