# GATE | GATE CS 2020 | Question 32

Consider the following C program.

 `#include   ` `int` `main ()  {  ` `    ``int`  `a = {{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 _______ .

Note – This question was Numerical Type.
(A) 18
(B) 19
(C) 20
(D) 14

Explanation: Given a is 2D array. Let starting address (or base address) of given array is 1000.

Therefore,

```= *(*(a+**a+2)+3))
= *(*(1000+**1000+2)+3))
= *(*(1000+3)+3))   {given element **1002 = 3}
= *(*(1003)+3))
= *((1003)+3)    {4th row selected in given matrix}
= *((1003)+3)     {address of 4th element in 4th row}
= a
= 19            {element selected a = 19} ```

 `#include   ` `int` `main ()  {  ` `    ``int`  `a = {{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);  ` `}   `

Option (B) is correct.

Quiz of this Question

My Personal Notes arrow_drop_up
Article Tags :

1

Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.