901 views
4 votes
4 votes
#include<stdio.h>

int main() {
   int arr[2][3][2]={{{2,4},{7,8},{3,4},},{{2,2},{2,3},{3,4},}};
   print("\n%d",**(*arr+1)+2+7);
   return 0;
}
plz explain this program, internally how it's stored in memory & how to execute,(forget if any syntactic error in the program)

3 Answers

7 votes
7 votes

ans is 16

Yes explanation is -

Always try to manipulate such Questions using diagrams so it will never go wrong.

(Consider all addresses are temporary)

*arr = 200

*arr+1 = 200+(1*size of array of 2 elemnts) = 208

so it will then point to block 208

*(*arr+1) = 308

*(*(*arr+1)) = 7

7+7+2 =16

:)

0 votes
0 votes

hope you got your answer , i have done each step by executing it in desktop , so i got all the address in hexa form , so whenever you wanna add any number, just covert that number from decimal to hexa using your calc . then add . same thing i have done in step no 2 

Related questions

6 votes
6 votes
2 answers
1
Abhisek Tiwari 4 asked Oct 20, 2018
2,263 views
int arr [3] ;print(arr -arr[0],arr [0]-arr[0][0])P.s :Sorry i can't able to paste the question but this is main Context.
3 votes
3 votes
2 answers
2
Anjan asked Jan 8, 2018
6,358 views
Consider 3 dimensional Array A[90] [30] [40] stored in linear array. If the base address starts at 10, The location of A [20] [20] [30] in case of RMO and CMO are _______...
5 votes
5 votes
6 answers
3
Pankaj Joshi asked Jan 26, 2017
15,855 views
Consider 3 dimensional Array A[90] [30] [40] stored in linear array in column major order. If the base address starts at 10. The location of A[20] [20] [30] is __________...
3 votes
3 votes
1 answer
4
KISHALAY DAS asked Dec 11, 2016
1,380 views