1,387 views
5 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 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 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.
Position:
Show:

Related questions

8 8 votes
1 1 answer
282
282 views
GO Classes asked Jun 19
282 views
What is the output of the following code?#include <stdio.h void fun(int a[], int *p) { a = a + 5; *(p + 2) = *(p + 2) + 10; p++; *p = *p + 1; } int main() { int arr[] =...
6 6 votes
1 1 answer
224
224 views
GO Classes asked Jun 19
224 views
What is the output of the following code?#include <stdio.h int main() { int arr[] = {10, 20, 30}; int *p = arr; printf("%d %d", *p, *(arr + 2)); return 0; }$\texttt{10 20...
8 8 votes
1 1 answer
233
233 views
GO Classes asked Jun 6
233 views
What is the output of the following code?#include <stdio.h void change(int *p, int *q) { *p = *p + 4; *q = *p + *q; p = q; *p = *p - 3; } int main() { int a = 6, b = 10; ...
8 8 votes
1 1 answer
238
238 views
GO Classes asked Jun 6
238 views
What is the output of the following code?#include <stdio.h int main() { int a = 8, b = 12; int *p = &a; int *q = &b; *p = *p + *q; q = p; *q = *q - 5; printf("%d %d", a, ...