The GATE Grind

GATE 2020 CS – Question 32

Programming and Data Structures · Programming in C · 1 mark · Numerical answer

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 ______.

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: 19 to 19

Explanation

$**a = a[0][0] = 1$, so $a+1+2 = a+3$ points to row 3. $*(a+3)+3$ points to $a[3][3]$, which is 19.