
360 Programming in C
OUTPUT:
Addition of Three Dimensional arrays as follows: 2 4 6 8 10 12 14 16
9.29 Program to display addresses of multi-dimensional array and compute the addition of its
elements.
int main()
{
int a[2][2][2]={1,2,3,4,5,6,7,8},i,j,k,sum=0;
clrscr();
printf("Addresses of elements of an array are as follows:\n");
for(i=0;i<2;i++)
for(j=0;j<2;j++)
for(k=0;k<2;k++)
{
printf("%u ",&a[i][j][k]);
sum=sum+*(*(*(a+i)+j)+k);
}
printf("\n Sum of all the elements of array = %d",sum);
return 0;
}
OUTPUT:
Addresses of elements of an array are as follows:
65506 65508 65510 65512 65514 65516 65518 65520
Sum of all the elements of array = 36
Explanation: ...