36 votes 36 votes Consider the following C program. #include <stdio.h> int main () { int a[4] [5] = {{1, 2, 3, 4, 5}, {6, 7,8, 9, 10}, {11, 12, 13, 14, 15}, {16, 17,18, 19, 20}}; printf(“%d\n”, *(*(a+**a+2)+3)); return(0); } The output of the program is _______. Programming in C gatecse-2020 numerical-answers programming-in-c array 1-mark + – Arjun asked Feb 12, 2020 retagged Nov 30, 2022 by Lakshman Bhaiya Arjun 23.2k views answer comment Share Follow See all 2 Comments See all 2 2 Comments reply himanshud2611 commented Jan 28 reply Follow Share Concept: a = address of 0th index of 2D array i.e address of 1D array {1,2,3,4,5}. *a = address of 0th index element of 0th index of above array i.e address of first element of array(1) **a = value of 0th index element of 0th index of array above i.e 1. Similarly (a+3) represents address of 3rd index of 1-D array, *(a+3) represents address of 0th index of 3rd index of 1D array i.e address of 16 0 votes 0 votes Srken commented Mar 10 reply Follow Share good question on 2 dimensional array ,really enjoyed that 0 votes 0 votes Please log in or register to add a comment.
Best answer 50 votes 50 votes '$a$' is a two dimensional array. $a =$ address of $0^{th}$ index of 2-D array which means address of 1-D array $^*a =$ address of $0^{th}$ index element of $0^{th}$ index 1-D array $^{**}a =$ value at $0^{th}$ index element of $0^{th}$ index 1-D array $\implies ^{**}a = 1$ $\implies ^{**}a+2 = 1+2 = 3$ $a+3 =$ address of $3^{rd}$ index 1-D array $^*(a+3) = $ address of $0^{th}$ index element of $3^{rd}$ index 1-D array $^*(a+3)+3 =$ address of $3^{rd}$ index element of $3^{rd}$ index 1-D array $^*(^*(a+3)+3) =$ value at $3^{rd}$ index element of $3^{rd}$ index 1-D array $= 19$ Correct Answer: $19.$ Shaik Masthan answered Feb 12, 2020 selected May 31, 2021 by Arjun Shaik Masthan comment Share Follow See all 3 Comments See all 3 3 Comments reply Shaik Masthan commented Feb 13, 2020 reply Follow Share for practice : https://gateoverflow.in/254355/test-series-question 0 votes 0 votes tirth_patel commented Jan 23, 2022 reply Follow Share Amazing! 0 votes 0 votes Abhrajyoti00 commented Oct 25, 2022 reply Follow Share Easy conversion for these qs: $*(a+i) = a[i]$ Thus, $^*(a+3) = a[3]$ and $^*(^*(a+3)+3) = *(a[3]+3) = a[3][3] = 19$ 15 votes 15 votes Please log in or register to add a comment.
7 votes 7 votes Answer : 19 a[4] [5] = {{1, 2, 3, 4, 5}, {6, 7,8, 9, 10}, {11, 12, 13, 14, 15}, {16, 17,18, 19, 20}}; Lets solve step-by step : step1- * ( * ( a + ( * ( * a ) ) + 2 ) + 3 ) // note : ( *(* a)) = 1 step2- * ( * ( ( (a + 1 )+ 2) ) + 3 ) step3- * ( * ( a + 3) +3) // note : *(a+3) is address of the memory location where 16 is stored or address of 4th row step4- * ( * ( a + 3) +3) // note. : *(a+3)+3 now its the address of 4th row and 4th column index. (a+0) is 1st row so a+3 is 4th row or address of 19 step5- * ( * ( a + 3) +3) means value stored at 4th row and 4th column . so , 19 shivam001 answered Mar 30, 2020 shivam001 comment Share Follow See all 0 reply Please log in or register to add a comment.