878 views
5 votes
5 votes
Main()

{

int a[2][3][2]={{{2,4},{7,8},{3,4}},{{2,2},{2,3},{3,4}}};

Printf("%u",a);

Printf("%u",*a);

Printf("%u",**a);

Printf("%u",***a);

Printf("%u",a+1);

Printf("%u",*a+1);

Printf("%u",**a+1);

Printf("%u",***a+1);

}

2 Answers

Best answer
6 votes
6 votes
int a[2][3][2];

a can be taken as * to int[3][2];

sizeof(*a) = 3*2*4 = 24 (assuming sizeof(int) = 4)

Printf("%u",a); //address of a

Printf("%u",*a); //Address of a (a[0] = *(a+0))

Printf("%u",**a); ADDRESS of a (a[0][0] = *(*(a+0)+0))

Printf("%u",***a); 2 (a[0][0][0] = *(*(*a+0)+0)+0))

Printf("%u",a+1); address of a + sizeof(*a) = address of a +24

Printf("%u",*a+1); address of *a + sizeof(**a) = address of a + 8

Printf("%u",**a+1); address of **a + sizeof(***a) = address of a + 4

Printf("%u",***a+1); 2+1 = 3.
selected by
0 votes
0 votes
1. address of outer a[0]

2. address of a[0][0]

3. address of a[0][0][0]

4. value of a[0][0][0]

5. address of outer a[1]

6. address of a[1][0]

7. address of a[1][0][0]

8. value of a[1][0][0]

Please do correct if wrong.

Related questions

3 votes
3 votes
1 answer
1
Storm_907 asked Apr 16, 2023
441 views
Please explain this question void main() { int a =300; char *ptr = (char*) &a ; ptr++; *ptr=2; printf("%d" , a); }
4 votes
4 votes
4 answers
3
Manoj Kumar Pandey asked May 22, 2019
797 views
https://gateoverflow.in/?qa=blob&qa_blobid=14433986388826671915int main() { int a = 10; int *b = &a; scanf("%d",b); printf("%d",a+50); }What will be the Output of the fol...