The GATE Grind

GATE 2019 CS – Question 34

Programming and Data Structures · Arrays · 1 mark · Numerical answer

Consider the following C program:

#include <stdio.h>
int main(){
    int arr[]={1,2,3,4,5,6,7,8,9,0,1,2,5}, *ip=arr+4;
    printf("%d\n", ip[1]);
    return 0;
}

The number that will be displayed on execution of the program is ________.

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: 6

Explanation

$ip$ points to $arr[4]$, so $ip[1]$ is $arr[5]$, which is 6.