Programming in C
Programming Fundamentals
GATE 2019
Easy
Consider the following C program:
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
6
Explanation
ip=arr+4 points to arr[4]=5. ip[1] = *(ip+1) = *(arr+5) = arr[5] = 6.
Source: GATE CS 2019 (Set-2) (2019)
This question is part of a 15-day revision cycle — sign in and Project Forge will bring it back the day before you'd forget it.