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 4 of 6.

Vijay said:   1 decade ago
Hi karthi.

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

Anusha said:   1 decade ago
Can anyone explain this ? what do *a, **a, ***a mean?

Kavya said:   8 years ago
Well said @Kishore.

%u for address.
%d for value.
(1)

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

Sneha said:   1 decade ago
@sriram good explanation. It cleared my doubt.

Emanuel said:   9 years ago
I think 1002,1 and after it has no sense.

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

Hameetha said:   1 decade ago
Thanks sriram for clear explanation.

Praveena said:   9 years ago
Thanks, @Alisha. Nice explanation.

Hareesh said:   10 years ago
Can't understand please explain?


Post your comments here:

Your comments will be displayed after verification.