
302 Programming and Data Structures
OR
9.24 Write a program to display array elements and their address. Use array name it self as
a pointer.
# include <stdio.h>
# include <conio.h>
void main ()
{
int i;
int a(]£3]-{{l,2,3},{4,5,6},{7,8,9}};
clrscrO;
printf ("\tElements o f An Array with their addresses.\n\n ");
for (i=0,-i<9,‘i++)
printf ("%8u"Aa[0]l0}+i);
printf ( " [%d]",*(&a[0J[0]+i));
if(i==2 I I i==5)
printf ("\ n ");
}
}
Q V T E U T ;
Elements of An Array with their addresses.
1(4052] 2 [4054] 3 [4056]
4[4058] 5(4060] 6 [4062]
7 [4064] 8140661 9 [4068]
Explanation The logic of the program is same as the previous one. The only difference ...