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 _______
arr is base address of element $1$.
arr+$4$ is base address of element $5$. Let it ip.
ip[$1$]=*(ip+$1$)= Base address of element $6$.
6 is the answer.
Hence Ans is 6.
int arr[]={1,2,3,4,5,6,7,8,9,0,1,2,5} , *ip = arr+4;
printf("%d\n",ip[1]);
ip is an integer pointer that is currently holding the address where 5 is stored.(i.e. a[4])
ip[1] = *(ip+1) = value present at the next address i.e. 6. so it will print 6.
64.3k questions
77.9k answers
244k comments
80.0k users