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` is a $4\times5$ array. Evaluate `*(*(a+**a+2)+3)`:

Row 3 is `{16, 17, 18, 19, 20}`, so `a[3][3] = 19`. Output: **19**.

More Programming in C questions

All Programming in C questions →