C Programming - Pointers - Discussion

Discussion Forum : Pointers - Find Output of Program (Q.No. 18)
18.
What will be the output of the program assuming that the array begins at location 1002?
#include<stdio.h>

int main()
{
    int a[2][3][4] = { {1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 1, 2}, 
                       {2, 1, 4, 7, 6, 7, 8, 9, 0, 0, 0, 0} };
    printf("%u, %u, %u, %d\n", a, *a, **a, ***a);
    return 0;
}
1002, 2004, 4008, 2
2004, 4008, 8016, 1
1002, 1002, 1002, 1
Error
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
54 comments Page 5 of 6.

Venkatesh said:   1 decade ago
@sriram good explanaton I got you dude.

Ram said:   1 decade ago
When we use 3d array, we use *** and 2d for **.

So the value of ***a is a[0, 0, 0].

Alisha said:   1 decade ago
Here a ,*a,and **a are same .....they return starting address of the array.
***a means that a[0][0][0]. so it returns the value 1.

Ramya said:   1 decade ago
Need more clear answer.

Biswajit said:   1 decade ago
Thanks sriram. Nice explation

Pallavi said:   1 decade ago
Thanks a lot sriram. Your explanation was good.

Vijay said:   1 decade ago
Hi karthi.

Just assume it as cube structure having X, Y, Z axes.

Karthi said:   1 decade ago
I didn't understand this.

Please give explanation in easiest way.

Cfriend said:   1 decade ago
Three dimensional array
ex a[1][2][3]
it contain 6 elements
it's meaning is 1, 2 dimensional array of size [2][3]
and in 2 dimensional 2, 1 dimensional array containg 3 element each.

RAHUL said:   1 decade ago
3D array means?


Post your comments here:

Your comments will be displayed after verification.